[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge
From: |
Nick Bowler |
Subject: |
bug#17471: On Solaris 10, grep snapshot apparently hit by bleeding-edge Autoconf bug |
Date: |
Mon, 12 May 2014 14:02:59 -0400 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
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 <address@hidden>
> 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
> - address@hidden@
> + 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/)