Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>Why aren't these split into separate packages?

Because they're the same thing. What all is about are the `xgrep` commands being symlinks to `grep`. Though I guess you can have packages that just add the symlink.

>If some distro wants to include them with a warning that's also fair game.

Some distros already do what is recommended in release notes. Rather being symlinks they're wrapper scripts. E.g. in Nix the `fgrep` and `egrep` are just `exec ${nixpkgs.gnugrep}/bin/grep -F "$@"` and `-E` respectively.



GNU egrep and fgrep are wrapper scripts (and have been for 10 years for more). Wrapper scripts that now warn you not to use them.

https://git.savannah.gnu.org/cgit/grep.git/tree/src/egrep.sh


This should be the top comment lol.

Such an insanity...

They are wrapper scripts that precisely enable to obey to the advice the warning is giving, yet the warning ends up advising not using the wrapper...


I cannot edit anymore, so I add this: This is the case in a distribution (Arch) that has effectively taken the maintainer's advice into account, not the reverse.

So I was wrong, and let's not be unfair to the maintainer.


True, the symlink part is wrong. Guess I should've checked the code. But in similar vein, a distro can just have packages adding the scripts.

edit: But was not always wrong. Just terribly outdated. Searching the log I found the commit [5cb71b0] with the message:

  Add patch from
  Paul Eggert <> to comply with ridiculous
  guidelines (don't act differently if invoked as egrep or fgrep)
which made the change from creating symlinks to creating scripts. The code continued to adjust behavior according filename (in contrast to what someone would expect based on the commit message). Then few years afterwards in [d25bebd] the scripts and the symlink behavior were dropped for actual binaries, with in-source comment:

  /* We build specialized legacy "egrep" and "fgrep" programs.
     No program adjusts its behavior according to its argv[0].
     No scripts are provided as an alternative.  Distributors
     are free to do otherwise, but it is their burden to do so.  */
It also funnily added the following prints, quite similar to what they're doing now:

  Invocation as `egrep' is deprecated; use `grep -E' instead.

  Invocation as `fgrep' is deprecated; use `grep -F' instead.
The scripts returned about a decade later (or else few years ago) in [b639643]. The commit message mentioned the reasoning:

  Although egrep's and fgrep's switch from shell scripts to
  executables may have made sense in 2005, it complicated
  maintenance and recently has caused subtle performance bugs.
  Go back to the old way of doing things, as it's simpler and more
  easily separated from the mainstream implementation.  This should
  be good enough nowadays, as POSIX has withdrawn egrep/fgrep and
  portable applications should be using -E/-F anyway.
[5cb71b0]: https://git.savannah.gnu.org/cgit/grep.git/commit/?id=5cb71b...

[d25bebd]: https://git.savannah.gnu.org/cgit/grep.git/commit/?id=d25beb...

[b639643]: https://git.savannah.gnu.org/cgit/grep.git/commit/?id=b63964...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: