Re: [Libguestfs] [PATCH nbdkit] tests: Cancel trap in cleanup function to avoid recursive traps.

Eric Blake
Wed, 01 Aug 2018 14:06:08 -0000

On 08/01/2018 08:54 AM, Richard W.M. Jones wrote:
> In these test functions, when a test fails, the bash ‘trap’ command
> causes the cleanup function to be called.  However bash does not annul
> or cancel the traps when cleanup is called, so at the end of the
> cleanup function when ‘exit’ is called, cleanup is called recursively.
>
> Avoid this by cancelling the traps at the top of the cleanup function.
> Also an extra debugging message is emitted here giving the value of
> $status which can be useful.

ACK

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org