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

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

 



On Fri, Apr 27, 2018 at 05:47:27PM +0200, Martijn Dekker wrote:
>
> No, because step 1 doesn't merely close fd 8. It enters a curly braces block
> (a compound command) that locally closes fd 8 using a redirection, just like
> any other redirection would be local to that compound command. Thus,
> restoring the fd state when leaving that block must undo the effect of the
> 'exec'.
> 
> Note that dash already does this correctly if the '8<&-' is replaced by any
> other redirection such as '8>/dev/tty'.

That's different as 8 was previously closed and is now open.

> POSIX 2.7 Redirection says: "Redirection is used to open and close files for
> the current shell execution environment [...] or for any command". Note that
> "any command" includes compound commands such as curly braces blocks.

Well, I don't see anything in POSIX that requires us to close fd 8.
Can you please point it out to me please?

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux