[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: {un,}setenv fixes
From: |
Jim Meyering |
Subject: |
Re: {un,}setenv fixes |
Date: |
Tue, 17 Nov 2009 10:45:22 +0100 |
Eric Blake wrote:
> Coreutils got recent reports of a FreeBSD failure on 'env -u a=b', which
> should
> fail because unsetenv should reject invalid environment variable names (kind
> of
> obvious, though, when you realize BSD unsetenv returns void instead of int,
> contrary to the POSIX signature). I think this should fix it, although so far
> I have only tested it on mingw and Solaris 8 (both functions are missing),
> cygwin 1.5 (where setenv was broken, but unsetenv worked) and cygwin 1.7 and
> Solaris 10 (where both functions obey POSIX, at least after today's patch to
> cygwin). I'll test on a few more platforms, then push.
test-unsetenv is failing on Solaris 10:
$ env -i $(type -p gdb) -q ./test-unsetenv
(gdb) r
Starting program: /tmp/.j/coreutils-8.0.125-6609c/gnulib-tests/test-unsetenv
test-unsetenv.c:50: assertion failed
Program received signal SIGABRT, Aborted.
0xff2cc674 in _lwp_kill () from /lib/libc.so.1
(gdb) bt
#0 0xff2cc674 in _lwp_kill () from /lib/libc.so.1
#1 0xff265a7c in raise () from /lib/libc.so.1
#2 0xff241954 in abort () from /lib/libc.so.1
#3 0x00010a2c in main () at test-unsetenv.c:50
(gdb) p *((char **)environ)@5
$1 = {0xffbfff9e "LINES=98", 0xffbfff93 "COLUMNS=81", 0xffbffe64 "a=2", 0x0,
0x0}
(gdb) up
#1 0xff265a7c in raise () from /lib/libc.so.1
(gdb)
#2 0xff241954 in abort () from /lib/libc.so.1
(gdb)
#3 0x00010a2c in main () at test-unsetenv.c:50
50 ASSERT (getenv ("a") == NULL);
(gdb)
Of the env-related replacement functions, only putenv was compiled:
$ ls ../lib/*env.o
../lib/putenv.o
The above makes me wonder if Solaris 10 needs the unsetenv replacement.