Re: [BUG] failure to push/restore closed file descriptor

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

 



Harald van Dijk <harald@xxxxxxxxxxx> wrote:
> On 23/04/2018 19:56, Martijn Dekker wrote:
>> $ dash -c '{ exec 8</dev/null; } 8<&-; : <&8 && echo "oops, still open"'
>> Output: "oops, still open"
>> Expected output: Bad file descriptor
>> 
>> Apparently, dash either fails to push the file descriptor onto the stack 
>> at '} 8<&-', or fails to restore it.
>> 
>> Same bug with loops ending in "done 8<&-".
>> 
>> Confirmed in all dash versions down to 0.5.5.1.
> 
> What surprises me most is that dash has code written specifically to 
> keep the fd closed. dash would be smaller and simpler if it behaved the 
> way you expected and the way most other shells behave: just remove all 
> traces of REALLY_CLOSED.

So did anything happen on the bash front? I'm happy to change if
bash moves in the same direction.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux