[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: env -u behavior
From: |
Eric Blake |
Subject: |
Re: env -u behavior |
Date: |
Sat, 24 Oct 2009 06:28:01 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Mike Frysinger on 10/24/2009 12:11 AM:
> 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");
Which is required to fail. But right now we call putenv("a=b"), which
puts "a=b" into the environment instead of unsetting "a".
> unsetenv("");
Which is required to fail. But right now we call putenv(""), which is a
silent no-op.
>
> 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
But that's my point - we aren't calling unsetenv(). Should we be?
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkri8tEACgkQ84KuGfSFAYC/mACgjHEVsGr1LqNRKWX0JzPspOtR
Cb0AoKC5Y4/51KS9LoAbJ7e9Xs3FFXUa
=a/lR
-----END PGP SIGNATURE-----
- env -u behavior, Eric Blake, 2009/10/23
- Re: env -u behavior, Mike Frysinger, 2009/10/24
- Re: env -u behavior,
Eric Blake <=
- Re: env -u behavior, Mike Frysinger, 2009/10/25
- Re: env -u behavior, Eric Blake, 2009/10/26
- Re: env -u behavior, Mike Frysinger, 2009/10/26
- Re: env -u behavior, Eric Blake, 2009/10/26
- Re: env -u behavior, Jim Meyering, 2009/10/26