Re: [PATCH v3] redir: Handle nested exec within REALLY_CLOSED redirection

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

 



Op 16-01-19 om 14:32 schreef Herbert Xu:
> So I'm going to go for a more complicated fix:

The v3 patch introduces a bug:

====begin test script====
init() {
        exec 8</dev/null
} >&-

{
        init
        : <&8 && echo ok
} 8<&-
====end test script====

Actual output:
test2.sh: 9: test2.sh: 8: Bad file descriptor

Expected output:
ok

The 'read' gets a 'bad file descriptor', so the effect of the 'exec'
from the init function is lost.

Interestingly, removing either the ">&-" from the function definition
block, or the "8<&-" from the other braces block, or both, makes the
error go away.

- Martijn



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

  Powered by Linux