Collin Funk <[email protected]> writes:

> Bruno Haible via GNU coreutils General Discussion <[email protected]>
> writes:
>
>>  a b=c d
>> +__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
>> + fail=1
>
> I forgot about Core Foundation inserting this random environment
> variable when you link to it. :(

I pushed the attached patch to filter it out, along with making the
regex a bit more strict.

No need to re-run the CI again, since I used it to test the patch.

Collin

>From f5e1fd312683e039985c733037f81e6c1378ac2a Mon Sep 17 00:00:00 2001
Message-ID: <f5e1fd312683e039985c733037f81e6c1378ac2a.1786415224.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Mon, 10 Aug 2026 19:23:10 -0700
Subject: [PATCH] tests: env,printenv: fix test failures on macOS

* tests/env/env.sh: Filter out __CF_USER_TEXT_ENCODING from the output.
Make the regex more strict.
* tests/misc/printenv.sh: Likewise.
Reported by Bruno Haible.
---
 tests/env/env.sh       | 3 ++-
 tests/misc/printenv.sh | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/env/env.sh b/tests/env/env.sh
index a4cc00598..a6eb6260b 100755
--- a/tests/env/env.sh
+++ b/tests/env/env.sh
@@ -204,7 +204,8 @@ tr "'" '"' <exp-noargs-shell >exp-noargs-c || framework_failure_
 for qs in literal shell c; do
   env -i PATH="$PATH" QUOTING_STYLE=$qs 'a b'='c d' \
     env >out-t 2>err || fail=1
-  grep -vE 'QUOTING_STYLE|PATH' out-t > out || framework_failure_
+  grep -vE '^["'"'"']?(__CF_USER_TEXT_ENCODING|QUOTING_STYLE|PATH)["'"'"']?=' \
+    out-t >out || framework_failure_
   compare exp-noargs-$qs out || fail=1
   compare /dev/null err || fail=1
 done
diff --git a/tests/misc/printenv.sh b/tests/misc/printenv.sh
index 0cb90681e..8ec228a6a 100755
--- a/tests/misc/printenv.sh
+++ b/tests/misc/printenv.sh
@@ -98,7 +98,8 @@ tr "'" '"' <exp-args-shell >exp-args-c || framework_failure_
 for qs in literal shell c; do
   env -i PATH="$PATH" QUOTING_STYLE=$qs 'a b'='c d' \
     printenv >out-t 2>err || fail=1
-  grep -vE 'QUOTING_STYLE|PATH' out-t > out || framework_failure_
+  grep -vE '^["'"'"']?(__CF_USER_TEXT_ENCODING|QUOTING_STYLE|PATH)["'"'"']?=' \
+    out-t >out || framework_failure_
   compare exp-noargs-$qs out || fail=1
   compare /dev/null err || fail=1
   env -i PATH="$PATH" QUOTING_STYLE=$qs 'a b'='c d' \
-- 
2.55.0

Reply via email to