From unknown Mon Aug 18 00:03:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#20883 <20883@debbugs.gnu.org> To: bug#20883 <20883@debbugs.gnu.org> Subject: Status: egrep on Solaris fails to call original grep binary Reply-To: bug#20883 <20883@debbugs.gnu.org> Date: Mon, 18 Aug 2025 07:03:07 +0000 retitle 20883 egrep on Solaris fails to call original grep binary reassign 20883 grep submitter 20883 Vladimir Marek severity 20883 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 23 11:39:48 2015 Received: (at submit) by debbugs.gnu.org; 23 Jun 2015 15:39:48 +0000 Received: from localhost ([127.0.0.1]:55474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7QId-0001RL-My for submit@debbugs.gnu.org; Tue, 23 Jun 2015 11:39:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46103) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7QIb-0001R2-Dv for submit@debbugs.gnu.org; Tue, 23 Jun 2015 11:39:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7QIR-0008ME-7T for submit@debbugs.gnu.org; Tue, 23 Jun 2015 11:39:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,UNPARSEABLE_RELAY autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7QIR-0008M6-58 for submit@debbugs.gnu.org; Tue, 23 Jun 2015 11:39:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7QIK-0003N1-OM for bug-grep@gnu.org; Tue, 23 Jun 2015 11:39:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7QIC-0008DV-J8 for bug-grep@gnu.org; Tue, 23 Jun 2015 11:39:28 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:47890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7QIC-0008DM-D8 for bug-grep@gnu.org; Tue, 23 Jun 2015 11:39:20 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t5NFdJlv007518 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Jun 2015 15:39:19 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t5NFdIkr017623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 23 Jun 2015 15:39:19 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t5NFdIqc024708 for ; Tue, 23 Jun 2015 15:39:18 GMT Received: from virtualz.cz.oracle.com (/10.163.86.15) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Jun 2015 08:39:17 -0700 Date: Tue, 23 Jun 2015 17:39:15 +0200 From: Vladimir Marek To: bug-grep@gnu.org Subject: egrep on Solaris fails to call original grep binary Message-ID: <20150623153915.GP6560@virtualz.cz.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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 grep=@grep@ 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|[@]SHELL@|$(SHELL)|g' \ -e "$$edit_substring" \ -e "s|[@]grep@|$$grep|g" \ + -e "s|[@]prefix@|$(prefix)|g" \ -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t $(AM_V_at)chmod +x $@-t $(AM_V_at)mv $@-t $@ 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 14:43:49 2015 Received: (at 20883) by debbugs.gnu.org; 24 Jun 2015 18:43:49 +0000 Received: from localhost ([127.0.0.1]:56632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7peH-0000DJ-0I for submit@debbugs.gnu.org; Wed, 24 Jun 2015 14:43:49 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49072) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7peE-0000D6-IR for 20883@debbugs.gnu.org; Wed, 24 Jun 2015 14:43:47 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 786C716084C; Wed, 24 Jun 2015 11:43:40 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Yc8eRfiEvAeL; Wed, 24 Jun 2015 11:43:39 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6FB8B160835; Wed, 24 Jun 2015 11:43:39 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YTgPOosguG1z; Wed, 24 Jun 2015 11:43:39 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 501FD16026C; Wed, 24 Jun 2015 11:43:39 -0700 (PDT) Message-ID: <558AFA5B.6040107@cs.ucla.edu> Date: Wed, 24 Jun 2015 11:43:39 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Vladimir Marek , 20883@debbugs.gnu.org Subject: Re: bug#20883: egrep on Solaris fails to call original grep binary References: <20150623153915.GP6560@virtualz.cz.oracle.com> In-Reply-To: <20150623153915.GP6560@virtualz.cz.oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 20883 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Vladimir Marek wrote: > $ PATH=/usr/bin gegrep > grep: illegal option -- E On recently-patched Solaris 10 with bleeding-edge GNU grep, I see the following instead: $ PATH=/usr/bin gegrep gegrep: not found The above behavior is with /bin/sh, and with gegrep installed in some directory that is in my ordinary PATH but not in /usr/bin. > 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 "$@" Assuming you configure this way: ./configure --prefix=/my/dir --program-prefix=g (which is how I did it), the egrep script in bleeding-edge grep (obtained from savannah via git) should be much simpler: #!/bin/bash exec ggrep -E "$@" and this may fix your problem (though I admit I don't understand your problem). The egrep script was simplified as part of the fix for Bug#19998; see: http://bugs.gnu.org/19998#37 By the way, probably you know this already, but portable scripts should not use egrep or fgrep, as these two commands have been removed from POSIX. They should use 'grep -E' and 'grep -F' instead. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 26 11:09:56 2015 Received: (at 20883) by debbugs.gnu.org; 26 Jun 2015 15:09:56 +0000 Received: from localhost ([127.0.0.1]:58307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8VGO-0002uU-12 for submit@debbugs.gnu.org; Fri, 26 Jun 2015 11:09:56 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:23190) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8VGM-0002uG-0u for 20883@debbugs.gnu.org; Fri, 26 Jun 2015 11:09:54 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t5QF9eUB013990 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Jun 2015 15:09:41 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t5QF9cvK024453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 26 Jun 2015 15:09:38 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t5QF9c0Y024194; Fri, 26 Jun 2015 15:09:38 GMT Received: from virtualz.cz.oracle.com (/10.163.86.15) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 26 Jun 2015 08:09:37 -0700 Date: Fri, 26 Jun 2015 17:09:34 +0200 From: Vladimir Marek To: Paul Eggert Subject: Re: bug#20883: egrep on Solaris fails to call original grep binary Message-ID: <20150626150934.GC26842@virtualz.cz.oracle.com> References: <20150623153915.GP6560@virtualz.cz.oracle.com> <558AFA5B.6040107@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <558AFA5B.6040107@cs.ucla.edu> User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 20883 Cc: 20883@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.7 (---) > >$ PATH=/usr/bin gegrep > >grep: illegal option -- E > > On recently-patched Solaris 10 with bleeding-edge GNU grep, I see the > following instead: > > $ PATH=/usr/bin gegrep > gegrep: not found > > The above behavior is with /bin/sh, and with gegrep installed in some > directory that is in my ordinary PATH but not in /usr/bin. > > >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 "$@" > > Assuming you configure this way: > > ./configure --prefix=/my/dir --program-prefix=g > > (which is how I did it), the egrep script in bleeding-edge grep (obtained > from savannah via git) should be much simpler: > > #!/bin/bash > exec ggrep -E "$@" That's a nice simplification of the previous state :) > and this may fix your problem (though I admit I don't understand your > problem). The egrep script was simplified as part of the fix for Bug#19998; > see: > > http://bugs.gnu.org/19998#37 > > By the way, probably you know this already, but portable scripts should not > use egrep or fgrep, as these two commands have been removed from POSIX. > They should use 'grep -E' and 'grep -F' instead. Thank you for the pointer, it helps. Also sorry for the not-so-clear report, after thinking about it twice, the problem in Solaris is that we provide both variants. With 'g' prepended and without. So I have to make the script a little bit more difficult. Thanks for your time looking at this and your help -- Vlad From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 26 16:40:13 2015 Received: (at 20883-done) by debbugs.gnu.org; 26 Jun 2015 20:40:14 +0000 Received: from localhost ([127.0.0.1]:58459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8aQ0-0005Bp-Fh for submit@debbugs.gnu.org; Fri, 26 Jun 2015 16:40:13 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58673) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8aPx-0005BM-IR for 20883-done@debbugs.gnu.org; Fri, 26 Jun 2015 16:40:10 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F07CE1601EA; Fri, 26 Jun 2015 13:40:03 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id PerP7gtQRbnQ; Fri, 26 Jun 2015 13:40:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 53652160821; Fri, 26 Jun 2015 13:40:03 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ikQMm6LuA1KZ; Fri, 26 Jun 2015 13:40:03 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3A02D1601EA; Fri, 26 Jun 2015 13:40:03 -0700 (PDT) Message-ID: <558DB8A3.5040209@cs.ucla.edu> Date: Fri, 26 Jun 2015 13:40:03 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Vladimir Marek Subject: Re: bug#20883: egrep on Solaris fails to call original grep binary References: <20150623153915.GP6560@virtualz.cz.oracle.com> <558AFA5B.6040107@cs.ucla.edu> <20150626150934.GC26842@virtualz.cz.oracle.com> In-Reply-To: <20150626150934.GC26842@virtualz.cz.oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 20883-done Cc: 20883-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Thanks for following up; sounds like grep is OK then, so closing the bug. From unknown Mon Aug 18 00:03:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 25 Jul 2015 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator