emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#20883: closed (egrep on Solaris fails to call orig


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20883: closed (egrep on Solaris fails to call original grep binary)
Date: Fri, 26 Jun 2015 20:41:03 +0000

Your message dated Fri, 26 Jun 2015 13:40:03 -0700
with message-id <address@hidden>
and subject line Re: bug#20883: egrep on Solaris fails to call original grep 
binary
has caused the debbugs.gnu.org bug report #20883,
regarding egrep on Solaris fails to call original grep binary
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20883: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20883
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: egrep on Solaris fails to call original grep binary Date: Tue, 23 Jun 2015 17:39:15 +0200 User-agent: Mutt/1.5.22.1-rc1 (2013-10-16)
Hi,

$ PATH=/usr/bin gegrep
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .


The gegrep script:

#!/bin/bash
grep=grep
case $0 in
  */*)
    dir=${0%/*}
    if test -x "$dir/grep"; then
      PATH=$dir:$PATH
      grep=grep
    fi;;
esac
exec $grep -E "$@"


The problem is that in the case when egrep is called without specifying full
path (there's no '/' in $0), it calls the grep binary (with -E option) in
default PATH. In the case of Solaris /usr/bin/grep is not a GNU grep, thus
error message about missing -E option.

I can see two possibilities of fixing it

a) As the GNU grep is called 'ggrep' on Solaris, we should use

grep=ggrep

and all is good. No need to change anything in GNU grep, just keep our
local Solaris patch.



b) As the GNU grep is available on /usr/gnu/bin path too (users who
deserve to have GNU commandline behavior use /usr/gnu/bin before
/usr/bin in PATH), we should use the /usr/gnu/bin prefix path for grep:

--- grep-2.20/src/egrep.sh      2015-06-23 14:03:57.123888876 +0200
+++ grep-2.20/src/egrep.sh      2015-06-23 14:03:27.529153050 +0200
@@ -7,5 +7,8 @@ case $0 in
       PATH=$dir:$PATH
       address@hidden@
     fi;;
+  *)
+    PATH="@prefix@/bin:$PATH"
+    ;;
 esac
 exec $grep @option@ "$@"
--- grep-2.20/src/Makefile.am  2015-06-23 07:17:45.984838354 -0700
+++ grep-2.20/src/Makefile.am  2015-06-23 07:17:45.052710962 -0700
@@ -56,6 +56,7 @@ egrep fgrep: egrep.sh Makefile
       sed -e 's|address@hidden@|$(SHELL)|g' \
           -e "$$edit_substring" \
           -e "s|address@hidden@|$$grep|g" \
+          -e "s|address@hidden@|$(prefix)|g" \
           -e "s|address@hidden@|$$option|g" <$(srcdir)/egrep.sh >address@hidden
       $(AM_V_at)chmod +x address@hidden
       $(AM_V_at)mv address@hidden $@



Generally I do believe that a) is easier and less risky change, but b)
feels to be more generic fix. (User may have GNU grep installed in /tmp
in which case /tmp/bin/egrep won't work unless you have /tmp/bin in your
PATH).


Comments welcome :)

Thank you
-- 
        Vlad



--- End Message ---
--- Begin Message --- Subject: Re: bug#20883: egrep on Solaris fails to call original grep binary Date: Fri, 26 Jun 2015 13:40:03 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
Thanks for following up; sounds like grep is OK then, so closing the bug.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]