[Top][All Lists]

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

Re: [Bug-tar] tar 1.24: OpenBSD testsuite failures

From: Eric Blake
Subject: Re: [Bug-tar] tar 1.24: OpenBSD testsuite failures
Date: Thu, 28 Oct 2010 08:05:27 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

On 10/27/2010 09:30 PM, Paul Eggert wrote:
> OpenBSD /bin/sh, and some other sh variants, squirrel away file
> descriptors before closing them.

ALL shells squirrel away file descriptors before closing them for the
duration of a builtin command, if there is a chance that a later shell
command will be executed that no longer needs the temporary closure.

It's just that ksh is a bit smarter about recognizing the last command
in a script, and doesn't squirrel away when there are no subsequent
commands that could possible need the fd.  But as was pointed out on the
dash list, this means that ksh is buggy when there is an exit trap
installed such that there really ARE commands after the last command of
the script:

$ ksh93 -c ':; trap "echo hi" EXIT >/dev/null'

All other shells output hi, because the redirection to /dev/null should
only have lasted for the duration of installing the trap, and not for
the actual execution of the trap.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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