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).

Bruno

>From 3291e071140b01129c0e5b57967405434b35b325 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 2 Nov 2025 10:21:15 +0100
Subject: [PATCH] env: document role of environment variables that start with
 __

* doc/coreutils.texi (env invocation): Document role of environment
variables that start with __.
---
 doc/coreutils.texi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 13f9f9a46..061228b90 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -18135,6 +18135,11 @@ However, it is wise to limit yourself to names that
 consist solely of underscores, digits, and ASCII letters,
 and that begin with a non-digit, as applications like the shell do not
 work well with other names.
+Also, you should avoid environment variables with names that start
+with two underscores,
+@c So far, this applies only to macOS and __CF_USER_TEXT_ENCODING.
+because such environment variables can be set by the operating system
+or influence the behavior of the operating system.
 
 @vindex PATH
 The first operand that does not contain the character @samp{=}
-- 
2.51.0

Reply via email to