GNU bug report logs - #49996
egrep and fgrep?

Previous Next

Package: grep;

Reported by: Simon Josefsson <simon <at> josefsson.org>

Date: Wed, 11 Aug 2021 07:23:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49996 in the body.
You can then email your comments to 49996 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#49996; Package grep. (Wed, 11 Aug 2021 07:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Josefsson <simon <at> josefsson.org>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Wed, 11 Aug 2021 07:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Josefsson <simon <at> josefsson.org>
To: bug-grep <at> gnu.org
Subject: egrep and fgrep?
Date: Wed, 11 Aug 2021 09:22:45 +0200
[Message part 1 (text/plain, inline)]
Hi!  A long standing pet issue of mine are the "deprecated" (since
2005?) tools fgrep and egrep.  If there is any meaning to the term
"deprecated", maybe they should be dropped at some point, or the
deprecation-status escalated (stderr warning? syslog output?).  What do
you think?

Maybe now is an acceptable time to drop them, I recall seeing some more
recent distributions that do not provide them, and things appears to
work for them except for the rare bug here and there.

Alternatively, how about un-deprecating them, for compatibility with BSD
and deployed popular usage.  I must admint I use egrep quite often.  I
think un-deprecating tools/APIs is an acceptable thing to do in some
cases.

Maybe a middle-ground could exist, that they won't be installed (or
work?) in some "POSIX"-mode -- I think the main reason for deprecating
them was that POSIX dropped a requirement for them?  That doesn't
necessarily mean things must be deprecated.

/Simon
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#49996; Package grep. (Wed, 11 Aug 2021 07:35:01 GMT) Full text and rfc822 format available.

Message #8 received at 49996 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Simon Josefsson <simon <at> josefsson.org>
Cc: 49996 <at> debbugs.gnu.org
Subject: Re: bug#49996: egrep and fgrep?
Date: Wed, 11 Aug 2021 00:34:04 -0700
On 8/11/21 12:22 AM, Simon Josefsson via Bug reports for GNU grep wrote:
> I think the main reason for deprecating
> them was that POSIX dropped a requirement for them?

As I recall, it was because they were kinda useless cruft. Portable 
scripts can't use egrep and fgrep since they're not standardized, and 
for personal command-line usage aliases suffice and 'eg' is a better 
alias anyway (it's less typing).




Information forwarded to bug-grep <at> gnu.org:
bug#49996; Package grep. (Sat, 14 Aug 2021 10:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 49996 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 49996 <at> debbugs.gnu.org, Simon Josefsson <simon <at> josefsson.org>
Subject: Re: bug#49996: egrep and fgrep?
Date: Sat, 14 Aug 2021 12:43:09 +0200
On Wed, Aug 11, 2021 at 9:35 AM Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> On 8/11/21 12:22 AM, Simon Josefsson via Bug reports for GNU grep wrote:
> > I think the main reason for deprecating
> > them was that POSIX dropped a requirement for them?
>
> As I recall, it was because they were kinda useless cruft. Portable
> scripts can't use egrep and fgrep since they're not standardized, and
> for personal command-line usage aliases suffice and 'eg' is a better
> alias anyway (it's less typing).

IMHO, they must be removed.
Anyone who requires to be able to use "egrep" or "fgrep" from the
command line can use a function or alias. Given their lack of
standardization, those should not be used in scripts.

My only questions are "when?" and "how?". I.e. first release
intermediate scripts that emit a warning every time they are used, or
just drop them from the list of installed targets.

I won't do either now, but they've been deprecated for so long I'll
definitely consider it for the next release.




Information forwarded to bug-grep <at> gnu.org:
bug#49996; Package grep. (Sun, 15 Aug 2021 14:27:01 GMT) Full text and rfc822 format available.

Message #14 received at 49996 <at> debbugs.gnu.org (full text, mbox):

From: arnold <at> skeeve.com
To: jim <at> meyering.net, eggert <at> cs.ucla.edu
Cc: 49996 <at> debbugs.gnu.org, simon <at> josefsson.org
Subject: Re: bug#49996: egrep and fgrep?
Date: Sun, 15 Aug 2021 08:25:51 -0600
Jim Meyering <jim <at> meyering.net> wrote:

> IMHO, they must be removed.
> Anyone who requires to be able to use "egrep" or "fgrep" from the
> command line can use a function or alias. Given their lack of
> standardization, those should not be used in scripts.

I beg to differ.  Scripts is one thing.  But breaking 40+ years
of interactive usage merely because POSIX doesn't standardize fgrep
and egrep (anymore!) is doing thousands of users a disservice.

As software suppliers, we need to take into account the bigger picture
of day-to-day usage, and not only what POSIX standardizes and doesn't
standardize.

And I'm willing to bet that the majority of grep/egrep/fgrep invocations
come from the command line rather than from scripts.

Arnold




Information forwarded to bug-grep <at> gnu.org:
bug#49996; Package grep. (Sun, 15 Aug 2021 18:12:02 GMT) Full text and rfc822 format available.

Message #17 received at 49996 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: arnold <at> skeeve.com, jim <at> meyering.net
Cc: 49996 <at> debbugs.gnu.org, simon <at> josefsson.org
Subject: Re: bug#49996: egrep and fgrep?
Date: Sun, 15 Aug 2021 11:10:59 -0700
[Message part 1 (text/plain, inline)]
On 8/15/21 7:25 AM, arnold <at> skeeve.com wrote:
> I'm willing to bet that the majority of grep/egrep/fgrep invocations
> come from the command line rather than from scripts.

That's not true for me, as I almost always invoke 'grep' via a script or 
shell function or Emacs. And I'm skeptical that it's true worldwide.

I doubt whether we should remove egrep and fgrep immediately, as that'd 
be a bit sudden. But it's a good time to take the next step. Proposed 
patch attached.
[0001-egrep-fgrep-now-obsolete.patch (text/x-patch, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#49996; Package grep. (Mon, 16 Aug 2021 11:35:01 GMT) Full text and rfc822 format available.

Message #20 received at 49996 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 49996 <at> debbugs.gnu.org, Simon Josefsson <simon <at> josefsson.org>,
 Aharon Robbins <arnold <at> skeeve.com>
Subject: Re: bug#49996: egrep and fgrep?
Date: Mon, 16 Aug 2021 13:32:16 +0200
On Sun, Aug 15, 2021 at 8:11 PM Paul Eggert <eggert <at> cs.ucla.edu> wrote:
>
> On 8/15/21 7:25 AM, arnold <at> skeeve.com wrote:
> > I'm willing to bet that the majority of grep/egrep/fgrep invocations
> > come from the command line rather than from scripts.
>
> That's not true for me, as I almost always invoke 'grep' via a script or
> shell function or Emacs. And I'm skeptical that it's true worldwide.
>
> I doubt whether we should remove egrep and fgrep immediately, as that'd
> be a bit sudden. But it's a good time to take the next step. Proposed
> patch attached.

Thanks for writing that, Paul. The patch looks fine.
The irony... that one of our own tests used fgrep!
One nit in the commit log:
> * src/egrep.sh: Issue a obsolescence warning.

s/a/an/




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 16 Aug 2021 17:15:02 GMT) Full text and rfc822 format available.

Notification sent to Simon Josefsson <simon <at> josefsson.org>:
bug acknowledged by developer. (Mon, 16 Aug 2021 17:15:02 GMT) Full text and rfc822 format available.

Message #25 received at 49996-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: 49996-done <at> debbugs.gnu.org, Simon Josefsson <simon <at> josefsson.org>,
 Aharon Robbins <arnold <at> skeeve.com>
Subject: Re: bug#49996: egrep and fgrep?
Date: Mon, 16 Aug 2021 10:14:02 -0700
On 8/16/21 4:32 AM, Jim Meyering wrote:

>> * src/egrep.sh: Issue a obsolescence warning.
> 
> s/a/an/

Thanks, I fixed that and installed the result with a bug# in the commit 
message. Closing the bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Sep 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.