bug-bash
[Top][All Lists]
Advanced

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

Re: close(63) after ENOEXEC


From: Chet Ramey
Subject: Re: close(63) after ENOEXEC
Date: Mon, 16 Jun 2014 12:18:54 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 6/11/14, 9:45 AM, Harald Koenig wrote:

> Bash Version: 4.3
> Patch Level: 18
> Release Status: release
> 
> Description:
>         bash closes fd #63 for process subsitution when executing script
>         without shebang line.
>         I don't see why this might be a feature -- so I assume it's a bug;)

Bash takes great care to close file descriptors open to pipes when it forks
children.  Stray open file descriptors can result in processes hanging
waiting for EOF and processes not receiving EPIPE or write errors.

Your particular use case results in bash forking, but not execing (since
the execve fails), and effectively restarting itself with the script as an
argument.  The bitmap of open FIFOs is unchanged in the forked process.

It's a simple matter to clear the bitmap bash keeps of open fifos in this
re-initialized state so the file descriptors don't get closed.  I'll have
to think about whether or not this is the right thing to do in the presence
of other open pipe FDs.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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