read(1) garbage when input redirected from make incorrectly
Tod McQuillin
devin at spamcop.net
Tue Feb 16 18:03:13 UTC 2010
On Tue, 16 Feb 2010, Garrett Cooper wrote:
> [gcooper at optimus ~]$ python -c 'import sys; sys.stdin.read()' < make -V
> bash: make: No such file or directory
> [gcooper at optimus ~]$ perl -e 'while (<>) { print; }' < make -V
> bash: make: No such file or directory
No, you have to say:
python -c 'import sys; sys.stdin.read()' < /usr/bin/make
perl -e 'while (<>) { print; }' < /usr/bin/make -V
What was happening in your first example is that the actual file
/usr/bin/make on disk is being read directly ... /usr/bin/make is never
executed at all. That is why your hexdump showed an ELF header -- it came
from /usr/bin/make which is an ELF executable.
--
Tod
More information about the freebsd-hackers
mailing list