read(1) garbage when input redirected from make incorrectly

Garrett Cooper yanefbsd at gmail.com
Tue Feb 16 18:55:03 UTC 2010


On Tue, Feb 16, 2010 at 9:46 AM, Tod McQuillin <devin at spamcop.net> wrote:
> 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.

Yeah... nevermind duh. Case closed :P...
Thanks!
-Garrett


More information about the freebsd-hackers mailing list