Hi Lou.

Please keep the mailing list in loop when you answer.  Thanks.

I'm re-sending your answer to the list, so that it gets seen by the other
subscribers and registered in the bug tracker.

On 02/28/2012 03:05 PM, Lou Picciano wrote:
> Stefano,
> 
> Tks for your notes -
> I'm encouraged to think that, with a bit of work, I may just wind up with a
> perfect version of automake!
> On specific points:
> 
>    Ah, likely the famous ksh bug with "$@" and empty arguments:
> 
>      
> <http://lists.gnu.org/archive/html/automake-patches/2009-12/msg00037.html>
> 
>    Can you verify that your shell suffers of the problem described there?  If
>    yes, a patch to fix this issue should be trivial.
> 
> Looks like we reproduce that bug example exactly - what patch would you 
> propose?:
>
Just a simple workaround for the affected shell function(s); see the attached
patch.  Could you confirm it fixes your problem?

>    drlou@build:~$ foo.sh
>    ---
>    $#: 0
> 
>    ---
>    $#: 1
> 
>    ---
>    $#: 2
>    xy
>    ---
>    $#: 2
>    xy xay
>    ---
>    $#: 3
>    xay xy xby
>    ---
>    drlou@build:~$ sh foo.sh
>    ---
>    $#: 0
> 
>    ---
>    $#: 1
> 
>    ---
>    $#: 2
>    xy
>    ---
>    $#: 2
>    xy xay
>    ---
>    $#: 3
>    xay xy xby
>    ---
>    drlou@build:~$ ksh foo.sh
>    ---
>    $#: 0
> 
>    ---
>    $#: 1
> 
>    ---
>    $#: 2
>    xy
>    ---
>    $#: 2
>    xy xay
>    ---
>    $#: 3
>    xay xy xby
>    ---
> 
> On the 'find' question:
> 
>    find: bad option -links
>    find: [-E] [-H | -L] path-list predicate-list
> 
> 
>    Oops, your find (1) doesn't support the '-links' option, which is mandated 
> by
>    POSIX:<http://pubs.opengroup.org/onlinepubs/009604599/utilities/find.html>.
> 
> Yes, exactly right - build system defaults to 'solaris' find. working on this
> one next...:
> 
So you are planning to fix your system's version of find?  That would be great,
since it would allow us to avoid putting another ugly workaround in automake's
rules.

> drlou@build:~$ find -links
> find: illegal option -- l
> find: [-E] [-H | -L] path-list predicate-list
>
> drlou@build:~$ /usr/gnu/bin/find -links
> /usr/gnu/bin/find: missing argument to `-links'
> 
> Regards, Lou Picciano
> 

Thanks,
  Stefano


>From 6008179d652eeec30fe6ab9769d5eb25253f27cd Mon Sep 17 00:00:00 2001
Message-Id: <6008179d652eeec30fe6ab9769d5eb25253f27cd.1330447227.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Tue, 28 Feb 2012 17:40:24 +0100
Subject: [PATCH] tests: fix a spurious failure with the Korn Shell

See automake bug#10898.

At least the AT&T and OpenSolaris versions of the Korn shell have a
strange bug regarding the expression ${1+"$@"}: when exactly *one*
empty argument is passed to a shell function, inside that function
the expression ${1+"$@"} will expand to *nothing*, rather than to
to the single empty string, as one would expect.  This was causing
a spurious failure in our testsuite when a shell suffering of this
bug was used to run the test cases.

* tests/autoamke.test: Work around the bug, by avoiding the
indirection through the 'AUTOMAKE_fails' function.
---
 tests/defs.in |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/defs.in b/tests/defs.in
index 4990e30..b2061e7 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -527,7 +527,12 @@ AUTOMAKE_run ()
   expected_exitcode=$1
   shift
   exitcode=0
-  $AUTOMAKE ${1+"$@"} >stdout 2>stderr || exitcode=$?
+  # This case distinction is required to work around a ksh bug.
+  # See automake bug#10898.
+  case $# in
+    0) $AUTOMAKE ;;
+    *) $AUTOMAKE "$@" ;;
+  esac >stdout 2>stderr || exitcode=$?
   cat stderr >&2
   cat stdout
   test $exitcode = $expected_exitcode || Exit 1
@@ -539,7 +544,12 @@ AUTOMAKE_run ()
 # does not exit with STATUS.
 AUTOMAKE_fails ()
 {
-  AUTOMAKE_run 1 ${1+"$@"}
+  # This case distinction is required to work around a ksh bug.
+  # See automake bug#10898.
+  case $# in
+    0) AUTOMAKE_run 1;;
+    *) AUTOMAKE_run 1 "$@";;
+  esac
 }
 
 commented_sed_unindent_prog='
-- 
1.7.9

Reply via email to