GNU bug report logs - #17471
On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug

Previous Next

Package: grep;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sun, 11 May 2014 20:50:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nick Bowler <nbowler <at> elliptictech.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, Autoconf bugs <bug-autoconf <at> gnu.org>, 17471 <at> debbugs.gnu.org
Subject: bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug
Date: Mon, 12 May 2014 14:02:59 -0400
On 2014-05-12 10:33 -0700, Jim Meyering wrote:
[...]
> I think the attach patch is sufficiently portable to do what I want.
> Does anyone see a way to make it more efficient with a POSIX shell?
>
> From e2a305bff2be376f6dd29e52a1d32636e0c22706 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering <at> fb.com>
> Date: Mon, 12 May 2014 10:33:09 -0700
> Subject: [PATCH] egrep, fgrep: make wrappers portable to non-POSIX shells
> 
> * src/egrep.sh (grep): Use sed in a subshell in place of the
> POSIX sh construct, ${0%/*}.  The latter is not portable to
> Solaris 10.  Reported by Paul Eggert in http://debbugs.gnu.org/17471
> ---
>  src/egrep.sh | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/egrep.sh b/src/egrep.sh
> index f1b4146..0a374aa 100644
> --- a/src/egrep.sh
> +++ b/src/egrep.sh
> @@ -2,9 +2,10 @@
>  grep=grep
>  case $0 in
>    */*)
> -    if test -x "${0%/*}/@grep@"; then
> -      PATH=${0%/*}:$PATH
> -      grep=@grep@
> +    dirname=`echo "$0"|sed 's,//*[^/]*$,,'`

I'd write

   dirname=`expr x"$0" : x'\(.*\)/'`

but mainly for style reasons...

> +    if test -x "$dirname"/'@grep@'; then
> +      PATH="$dirname:$PATH"
> +      grep='@grep@'
>      fi;;
>  esac
>  exec $grep @option@ "$@"

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)




This bug report was last modified 11 years and 15 days ago.

Previous Next


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