env bug ?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Mar 9 13:50:27 UTC 2005


On Tue, Mar 08, 2005 at 09:19:16PM +0200, Peter L. Peres wrote:
> 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.

When the kernel sees '#!/usr/bin/env echo foo' /tmp/test it calls
/usr/bin/env "echo foo" "/tmp/test"

How is this env's fault?

env could certainly have a mechanism for dealing with it, but I am not
sure env is really doing anything wrong, assuming it was never intended
for use as a script interpreter.  perl knows how to deal with arguments
passed that way, bash knows, sh knows, etc.  Those are all script
interpreters, which env is not.  I think this is a case of using env in
a place it isn't meant to be used.

Lennart Sorensen
--
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