coreutils
[Top][All Lists]
Advanced

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

Re: new test fails on macOS


From: Collin Funk
Subject: Re: new test fails on macOS
Date: Tue, 25 Aug 2026 18:20:50 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Pádraig Brady <P@draigBrady.com> writes:

> It seems that this validation is only done on unsetenv() on FreeBSD?

I'm not too sure the exact details, I didn't look at the code aside from
finding the error message, and the preceding strchr + NULL check that
triggers that path.

>   $ printf 'A=1\0A=2\0foo\0' |
>     src/env --env0-from=- src/env foo=bar | grep foo
>   foo=bar
>   foo
>
>   $ printf 'A=1\0A=2\0foo\0' |
>     src/env --env0-from=- src/env -u foo
>   env: environment corrupt; missing value for foo
>   env: cannot unset ‘foo’: Bad address
>
>   $ printf 'A=1\0A=2\0foo\0' |
>     src/env --env0-from=- src/env -u bar
>   env: environment corrupt; missing value for foo
>   env: cannot unset ‘bar’: Bad address
>
> Anyway we can avoid the unsetenv() and putenv() in this case
> as we're only re-execing env(1) to get a standard env list with possible 
> implicit entries,
> we can do our manipulations before that.
> The attached passes on FreeBSD 15 at least (cfarm240).

I didn't test it myself, since I don't have different enough FreeBSD
machines to test on, but that patch looks good to me. Certainly better
than mine. I'd prefer to avoid $host_os checks as much as possible,
especially for systems that are actively developed and may change in the
future.

The 'git blame' shows that function hasn't been modified recently, and I
don't think anyone has a need to rewrite it. So, I feel your fix should
be robust enough.

Collin



reply via email to

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