bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: env -u behavior


From: Mike Frysinger
Subject: Re: env -u behavior
Date: Sat, 24 Oct 2009 02:11:37 -0400
User-agent: KMail/1.12.2 (Linux/2.6.31.4; KDE/4.3.2; x86_64; ; )

On Friday 23 October 2009 14:44:03 Eric Blake wrote:
> Is 'env -i -u a=b' really supposed to output a=b, or should it be an error
> (because a=b is not a valid environment name)?  Right now, it is the
>  former, because we are using putenv() to remove variables from environ,
>  rather than unsetenv().  Similarly, should env -u '' issue an error?

i dont think these things should error as there's no actual limitation in the 
coreutils code to do so (and POSIX allows this behavior).  the code should 
call unsetenv() on whatever the user gives it.  so in these two cases, it 
should do:
        unsetenv("a=b");
        unsetenv("");

same goes for setting invalid env vars like:
        env foo.cow=moo some-cmd
the env program should call:
        setenv("foo.cow", "moo", 1);

the only error that should be emitted is if the underlying unsetenv() or 
setenv() functions fail
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]