bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnulib-tool broken on solaris


From: Bruno Haible
Subject: Re: gnulib-tool broken on solaris
Date: Thu, 25 Feb 2010 12:13:39 +0100
User-agent: KMail/1.9.9

Ben Walton wrote:

> I updated my gnulib git repo tonight before patching it into some
> source and discovered that gnulib-tool was broken by commit 5b1da95 (I
> bisected).  I've verified this breakage on Solaris 8 - 10.
> 
> bwalton @ build8x : ~/gnulib
> $ ./gnulib-tool --help
> ./gnulib-tool[814]: syntax error at line 816 : `(' unexpected

Thanks for the report. On this platform, gnulib-tool reexecs through
/bin/ksh. A minimal test case is this:

$ cat foo.sh
alias echo='print -r'
case "$BASH_VERSION" in
  3.2*)
    echo ()
    {
      printf '%s\n' "$*"
    }
    ;;
esac
$ /bin/ksh foo.sh
foo.sh[2]: syntax error at line 4 : `(' unexpected

I'm applying this fix:


2010-02-25  Bruno Haible  <address@hidden>

        Fix breakage of gnulib-tool with ksh, introduced on 2010-02-21.
        * gnulib-tool: Define 'echo' as a function only before the ksh alias
        setting, not afterwards.
        Reported by Ben Walton <address@hidden>.

--- gnulib-tool.orig    Thu Feb 25 12:10:40 2010
+++ gnulib-tool Thu Feb 25 12:08:00 2010
@@ -727,7 +727,10 @@
 # For bash >= 2.0: define echo to a function that uses the printf built-in.
 # For bash < 2.0: define echo to a function that uses cat of a here document.
 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
-if test -z "$have_echo" \
+# Also handle problem 2, specific to bash 3.2, here.
+if { test -z "$have_echo" \
+     || case "$BASH_VERSION" in 3.2*) true;; *) false;; esac; \
+   } \
    && test -n "$BASH_VERSION"; then \
   if type printf 2>/dev/null | grep / > /dev/null; then
     # 'printf' is not a shell built-in.
@@ -810,15 +813,6 @@
   exec /bin/sh "$0" --no-reexec "$@"
   exit 127
 fi
-# Now handle problem 2, specific to bash 3.2.
-case "$BASH_VERSION" in
-  3.2*)
-    echo ()
-    {
-      printf '%s\n' "$*"
-    }
-    ;;
-esac
 if test -z "$have_echo"; then
   func_fatal_error "Shell does not support 'echo' correctly. Please install 
GNU bash and set the environment variable CONFIG_SHELL to point to it."
 fi




reply via email to

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