Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fermeture des file descriptors standard et conformance à POSIX #21

Open
dariuskramer opened this issue Mar 25, 2017 · 0 comments
Open

Comments

@dariuskramer
Copy link

Les tests qui vérifie la fermeture d'un fd standard avec l'opérateur &-, par exemple 21sh > redirections > inputs > 001-close-stdin, sont marqués comme échoué si le fd est remappé sur /dev/null.

Hors la Rationale, et par extension POSIX, ne recommande pas ce comportement.
Cf http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html, section C.2.7 Redirection:

Applications should not use the [n]<&- or [n]>&- operators to execute a utility or application with file descriptor 0 not open for reading or with file descriptor 1 or 2 not open for writing, as this might cause the executed program (or shell built-in) to misbehave. In order not to pass on these file descriptors to an executed utility or application, applications should not just close them but should reopen them on, for example, /dev/null. Some implementations may reopen them automatically, but applications should not rely on this being done.

Un possible fix serait que si le premier call à read retourne 0, alors on suppose que le fd est mappé sur /dev/null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant