[Top][All Lists]

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

Re: cat and awk and /dev/full on HP-UX B.11.31

From: Eric Blake
Subject: Re: cat and awk and /dev/full on HP-UX B.11.31
Date: Wed, 23 Jun 2010 06:53:25 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4

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
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.
>     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   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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