automake-patches
[Top][All Lists]
Advanced

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

Re: testsuite: fixed spurious failure in vala4.test (w.r.t. Solaris sh)


From: Ralf Wildenhues
Subject: Re: testsuite: fixed spurious failure in vala4.test (w.r.t. Solaris sh)
Date: Sat, 5 Dec 2009 12:15:38 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

Hi Stefano,

thanks for working on this more.

* Stefano Lattarini wrote on Fri, Dec 04, 2009 at 05:22:32PM CET:
> I think I found the bug in heirloom-sh which was triggering the 
> spurious failure (it's related with `set -e', as you guessed).  I also 
> found a simple workaround for it (caching the result of `pwd` command 
> substitution in a shell variable $cwd), which by the way also provided 
> a tiny optimization (two fewer forks).

> Subject: [PATCH] Intertwined optimization and bugfix in vala4.test
> 
> * tests/vala4.test: New variable $cwd, holding the full path of the
> current directory.  Use it instead of `pwd` command substitution.
> Document how a bug of Heirloom/Solaris Sh caused a spurious failure
> of this test script, and how our use of "$cwd" rather than "`pwd`"
> offers a workaround.

The workaround looks ok to me, but I must confess that I still don't
really understand the bug in a way that allows me to avoid it in similar
but not identical other situations in the future.

The Shell Portability section of the Autoconf manual (which is where a
detailed description of this issue belongs, not in a comment hidden in
some Automake test that we'll never care to look at again) documents
this:

     When `set -e' is in effect, a failed command substitution in
     Solaris `/bin/sh' cannot be ignored, even with `||'.

          $ /bin/sh -c 'set -e; foo=`false` || echo foo; echo bar'
          $ bash -c 'set -e; foo=`false` || echo foo; echo bar'
          foo
          bar

which seems related (never mind that there are typos in the manual that
use 'set -d' rather than 'set -e'; let's fix that as well).  But in the
above case, you can work around the failure by putting the || inside the
command substitution:

          set -e; foo=`false || echo foo`; echo bar

But then, the example in vala.test doesn't have the failure inside the
command substitution, so it's different.  So my next hypothesis was that
the shell somehow replaces the exit status from the outer command with
that of the command substitution.  But that's also not the case, as

          set -e; true `false` && exit 0

exits as well (which it shouldn't in that case).

So, can we find a concise textual description of the bug?

Thanks,
Ralf




reply via email to

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