[issue1337] HEAD can't build 2.2-RELEASE

Stathis Kamperis (via DragonFly issue tracker) sinknull at crater.dragonflybsd.org
Wed Apr 15 10:50:44 PDT 2009

Stathis Kamperis <ekamperi at gmail.com> added the comment:

: Using recent HEAD (April 12th 2009) buildkernel fails building 2.2-RELEASE.

The problem is due to running old env(1), which is part of the bootstrap tools
of the 2.2 release, in a host system with new libc/setenv(3). Here is the deal:

When you supply a "value=name" string to the old env(1), it doesn't actually
break it into 2 pieces (ie null terminate on =). It just creates 2 pointers, one
pointing to the start of "value" and one to the start of "name". These pointers
are subsequently passed to setenv(3). When new setenv(3) encounters the "=" as
part of the "name" it fails with EINVAL, which is exactly what it should do,
being in compliance with the POSIX standard.

So, how did it work with old (prior to recent libc changes) setenv(3) ?
Well, it seems that old setenv(3) just skipped all "=" in the "name". That said,
it was actually possible to call env with foo=bar=lala=123 and a variable named
"foo=bar=lala" would be created and assigned a value of "123".

My suggestion is to backport env.c changes[1] to the 2.2 branch. Hopefully this
would not break anything. I expect the previous insanity to be replaced by
something like this: calling env with foo=bar=lala=123 will cause the creation
of a "foo" variable, assigned with "123" value (= characters are ignored both in
value and in name). I am building a 2.2 release as I write this, to make sure
that building 2.2 under -current, doesn't break building 2.2 in a
pre-libc-changes machine.

If anyone is willing to test [1] with 2.0 or 2.2 release that would help. Also,
thomas, can you confirm that this patch unbreaks the 2.2 build under current ?


[1] http://leaf.dragonflybsd.org/~beket/env.diff

assignedto:  -> Beket
nosy: +Beket
status: unread -> testing

DragonFly issue tracker <bugs at lists.dragonflybsd.org>

More information about the Bugs mailing list