env bug ?

Peter L. Peres plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Tue Mar 8 19:19:16 UTC 2005



On Mon, 7 Mar 2005, Grant Cullen wrote:

>> I seem to have a problem with env: a file that starts with:
>> 
>>     #!/usr/bin/env echo foo
>> 
>> and is set +x and executes, will print:
>> 
>>     /usr/bin/env: echo foo: No such file or directory
>
> I tried it and got the same result, but when I put perl instead of echo foo. 
> It worked.  I am assuming that the command not found is echo (an internal 
> shell command) and therefore not in the path.
> Grant Cullen

The command env parses its arguments wrong and tries to execute the 
first token it finds, which is 'echo foo' (it fails the same with other 
things too, I gave it as an example. On my system there is an echo 
program).

Meanwhile I wrote a env replacement in C and I confirmed that there is 
nothing wrong with bash or the kernel mechanism that launches scripts. 
The bug is in env.

Peter
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list