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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/