bug#79714: env: always adds __CF_USER_TEXT_ENCODING var on macOS since v9.8

Pádraig Brady <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
On 02/11/2025 09:24, Bruno Haible via GNU coreutils Bug Reports wrote:
> Andrew Marshall wrote:
>> perhaps it’s worth documenting or making it an invalid config on Darwin.
> 
> We could document that users should not use environment variables
> that start with "__", because these environment variables can be
> set by the OS and can influence the behaviour of the OS. Proposed
> patch is attached.
> 
> Once that is documented, I don't think anything is wrong with
> CoreFoundation setting or use any __FOOBAR environment variable(s).

I think the doc change is a bit too much.
The user may very well want to change OS behavior.

Sure CoreFoundation is free to set any __FOOBAR variable,
but it's unfortunate that using env to set or clear specific env vars
has the side effect of implicitly setting __CF_USER_TEXT_ENCODING.
env -i is fine BTW as we'll exec with an empty environment.

I suppose if __CF_USER_TEXT_ENCODING was problematic for users
they've a workaround of explicitly unsetting it.

So yes not a huge issue, but best avoided if possible.

cheers,
Padraig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.