Don't pass shell loops' stdin to programs run on glibc's host
Joseph S. Myers
joseph@codesourcery.com
Sun Oct 21 22:42:00 GMT 2012
On Sat, 20 Oct 2012, Roland McGrath wrote:
> No test should ever read from the inherited stdin. For scripts, the robust
> thing to do is put "exec < /dev/null" somewhere near the top. For test
> programs run by the generic $< > $@ rule, we should just add < /dev/null
> to that command.
While I agree that such changes make sense, they would not address the
problem this patch is addressing. This patch is not about tests running
with stdin inherited from the test run as a whole (e.g. the user's
terminal). This patch is about shell scripts doing
while read foo; do
test_program
done < shell-loop-input
where within the loop the shell's input is redirected - and the "read"
command, but not the test programs, should see that redirection. Putting
"< /dev/null" at the top of the script, or in the makefiles, won't help
here.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list