[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: egrep moved to /usr/sbin



* Craig Dickson (crdic@pacbell.net) wrote:
> Stephen Frost wrote:
> > It's obvious that humans don't need egrep and fgrep, since the same
> > functionality is available in grep -E and grep -F.  Thus we should do
> > away with them entirely.
> 
> If grep were smart enough to check $0 and modify its behavior
> accordingly (I don't think it does currently), then egrep and fgrep
> could be replaced by links. Even without that, egrep and fgrep could be
> replaced by scripts that exec grep with appropriate arguments. Either
> way, egrep and fgrep would become negligibly small, and so the argument
> for moving them to /usr/bin would be much weaker.
> 
> There is merit in having egrep and fgrep available under those names,
> because people will expect them. They don't have to be in any particular
> place as long as they're on the standard $PATH, since programs shouldn't
> be hard-coding the locations of binaries from other packages. Startup
> scripts and other programs in the root fs are a special case, since they
> need to avoid using things that may not have been mounted yet, but the
> change from {ef}grep to grep -{EF} is trivial.

grep can be trivally compiled to check $0 and modify its behaviour as
appropriate.  The GNU folks *intentionally* broke that as the default
because of some (rather odd..) concern about programs acting differently
when they're called via links.  Personally I think they're wrong and
that having a program's behaviour depend on its $0 is acceptable so long
as there is a 'base' version which takes arguments for those who worry
about such things.  grep isn't the only thing that suffers from this
breakage (strip/objcopy is another example, I'm confident there are
more).

As mentioned in the other thread, my recommendation is that grep by
fixed to check it's $0 and act accordingly for grep/egrep/fgrep.  As I
also mentioned before I feel a shell script replacement would be
acceptable too (and should alleviate the concerns of those who feel the
same as the GNU folks).

I don't agree that scripts should be forced to use the base grep with
options and I don't agree with moving egrep/fgrep to /usr/bin.

	Stephen

Attachment: pgpfkAzp77u8p.pgp
Description: PGP signature


Reply to: