On Mon, Apr 23, 2007 at 08:19:54PM +0200, Albert Reiner wrote:
> ,----
> | $ tar cf /tmp/dummy.tar --files-from <(find /tmp)
> | tar: /dev/fd/63: Cannot stat: No such file or directory
> | tar: Error is not recoverable: exiting now
> `----

In bash <( ) is implemented by calling pipe() to open two connected
filedescriptors, forking, closing either one of them and giving the open
filedescriptor to tar using /proc/$pid/fd/nnn, which is also available
as /dev/fd/nnn. On startup tar closes all open filedescriptors except
the first three by calling closeoipen() in src/misc.c. Since /dev/fd/nnn
is then no longer a valid filedescriptor, the open() fails.

According to the changelog, closeopen() was introduced 2006-07-03, but
without any reason given. Since it breaks passing pipes via <() in bash,
I think this change should be reverted. I also can't think of any reason
to close inherited fds, unless you are going to detach and run as
daemon.

    Ingo
-- 
"Niemand hat die Absicht eine Mauer zu errichten"
        -- Walter Ulbricht, DDR-Staatsratsvorsitzender
           http://video.google.com/videoplay?docid=6233111545394191802

Attachment: signature.asc
Description: Digital signature

Reply via email to