bug-gnulib
[Top][All Lists]
Advanced

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

Re: tests: temporary files may be left behind


From: Jim Meyering
Subject: Re: tests: temporary files may be left behind
Date: Sat, 14 Nov 2009 13:33:14 +0100

Ralf Wildenhues wrote:
> * Jim Meyering wrote on Sat, Nov 14, 2009 at 01:11:38PM CET:
>> I propose to fix it by adding a trap ... 0.
>> A welcome side-effect is that with this change, you remove
>> temporary files from only one place: the trap, rather
>> than just prior to every other exit point.
>>
>> The only tricky part about the trap-0 is that you
>> have to be sure to preserve the exit status.
>
> Not only that, you also have to ensure to get the right exit status into
> the zero trap, by using something like
>   (exit $N); exit $N
>
> throughout, see '(autoconf.info)Limitations of Builtins'.
>
>> Here's the patch for that particular file:
>
> It is lacking a few of the above.

Hi Ralf,

Yes, I noticed those, but my change introduced no new ones.
Such an additional change (if desired) belongs in a separate patch.
It would affect far more scripts that I've targeted.

IMHO, we should start using this Exit function
(I think you're the one who first suggested it),

# We use a trap below for cleanup.  This requires us to go through
# hoops to get the right exit status transported through the signal.
# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
# sh inside this function.
Exit ()
{
  set +e
  (exit $1)
  exit $1
}

but that would require support for functions, which
some of these tests don't yet assume.

Actually, I'd like to make each and every test
source some other file with enough infrastructure
to ensure functions are supported, and things like
temp-dir creation and removal are handled automatically.
We really shouldn't be duplicating all of that in every
single test script.

However, I seem to recall that some people here didn't
want to do that.




reply via email to

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