On 06/19/2010 12:27 PM, Ralf Wildenhues wrote:
> I've considered piping the result of awk through cat, that would let the
> test pass, but that could in practice hide other errors which are
> notified by awk, at least on some systems.  I'm not sure that we can fix
> this in Autoconf, short of avoiding awk, and I don't think that is
> warranted for this limitation.

You can still portably catch both awk AND cat failures (although not
very concise), roughly like:

exec 3>&1
st=`exec 4>&1 >&3; echo foo | { awk '{print}'; echo $? >&4; } |
  cat > /dev/full`
if test $? != 0 || test $st != 0; then
  # either awk or cat failed
fi
exec 3>&-

In that way, we get the benefits of cat's write-error handling on HP-UX,
without losing the awk error detection elsewhere.  Is it worth the
change, though?

>     Accept any nonzero exit status upon config.status write failure.
>     
>     * tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
>     Normalize nonzero status to 1 for writing to /dev/full, for HP-UX
>     11.31 cat which exits 2.  The test still fails because awk does
>     not diagnose the write failure.

Meanwhile, this patch is okay to apply, as it gets the testsuite
incrementally better.

>  # Force write error creating a file on stdout
>  if test -w /dev/full && test -c /dev/full; then
> -  AT_CHECK([./config.status --file=-:input </dev/null >/dev/full],
> +  AT_CHECK([./config.status --file=-:input </dev/null >/dev/full || exit 1],
>          [1], [ignore], [ignore])
>  fi
>  

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to