jobcore/sudo/sudo-tests-pick-first-utf-8-locale.patch
2023-02-16 02:25:06 +02:00

216 lines
8.4 KiB
Diff

From 2845ceafb06d728b60a9d79d9d51a966e5ef66c2 Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
Date: Wed, 15 Feb 2023 13:49:04 -0700
Subject: [PATCH] Handle "locale -a" returning both C.UTF-8 and C.utf8. It is
possible to have mutiple matches from the output of "locale -a". Just take
the first one. Fixes GitHub issue #241.
---
lib/eventlog/Makefile.in | 2 +-
lib/iolog/Makefile.in | 10 +++++-----
lib/util/Makefile.in | 6 +++---
logsrvd/Makefile.in | 6 +++---
plugins/python/Makefile.in | 2 +-
plugins/sudoers/Makefile.in | 10 +++++-----
src/Makefile.in | 2 +-
7 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/lib/eventlog/Makefile.in b/lib/eventlog/Makefile.in
index 190470a82..cd713c483 100644
--- a/lib/eventlog/Makefile.in
+++ b/lib/eventlog/Makefile.in
@@ -152,7 +152,7 @@ check-fuzzer:
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
diff --git a/lib/iolog/Makefile.in b/lib/iolog/Makefile.in
index 4e1f3a4bc..61bc05815 100644
--- a/lib/iolog/Makefile.in
+++ b/lib/iolog/Makefile.in
@@ -200,7 +200,7 @@ fuzz_iolog_json_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_iolog_json: fuzz_iolog_json
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -225,7 +225,7 @@ fuzz_iolog_legacy_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_iolog_legacy: fuzz_iolog_legacy
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -250,7 +250,7 @@ fuzz_iolog_timing_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_iolog_timing: fuzz_iolog_timing
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -302,7 +302,7 @@ fuzz: run-fuzz_iolog_json run-fuzz_iolog_legacy run-fuzz_iolog_timing
check-fuzzer: $(FUZZ_PROGS)
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -319,7 +319,7 @@ check-fuzzer: $(FUZZ_PROGS)
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
diff --git a/lib/util/Makefile.in b/lib/util/Makefile.in
index 9a73f201e..7898eecea 100644
--- a/lib/util/Makefile.in
+++ b/lib/util/Makefile.in
@@ -360,7 +360,7 @@ fuzz_sudo_conf_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_sudo_conf: fuzz_sudo_conf
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -424,7 +424,7 @@ fuzz: run-fuzz_sudo_conf
check-fuzzer: $(FUZZ_PROGS)
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -438,7 +438,7 @@ check-fuzzer: $(FUZZ_PROGS)
# Note: some regress checks are run from srcdir for consistent error messages
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
diff --git a/logsrvd/Makefile.in b/logsrvd/Makefile.in
index 310ec1182..2a1f0d1a5 100644
--- a/logsrvd/Makefile.in
+++ b/logsrvd/Makefile.in
@@ -195,7 +195,7 @@ fuzz_logsrvd_conf_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_logsrvd_conf: fuzz_logsrvd_conf
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -256,7 +256,7 @@ fuzz: run-fuzz_logsrvd_conf
check-fuzzer: $(FUZZ_PROGS)
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -269,7 +269,7 @@ check-fuzzer: $(FUZZ_PROGS)
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
diff --git a/plugins/python/Makefile.in b/plugins/python/Makefile.in
index 4cac26c72..e79f57061 100644
--- a/plugins/python/Makefile.in
+++ b/plugins/python/Makefile.in
@@ -229,7 +229,7 @@ check-fuzzer:
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in
index c1a72f1fd..3dcc746f2 100644
--- a/plugins/sudoers/Makefile.in
+++ b/plugins/sudoers/Makefile.in
@@ -423,7 +423,7 @@ fuzz_policy_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_policy: fuzz_policy
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -448,7 +448,7 @@ fuzz_sudoers_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_sudoers: fuzz_sudoers
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -473,7 +473,7 @@ fuzz_sudoers_ldif_seed_corpus.zip:
rm -rf $$tdir
run-fuzz_sudoers_ldif: fuzz_sudoers_ldif
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -621,7 +621,7 @@ fuzz: run-fuzz_policy run-fuzz_sudoers run-fuzz_sudoers_ldif
check-fuzzer: $(FUZZ_PROGS)
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
@@ -638,7 +638,7 @@ check-fuzzer: $(FUZZ_PROGS)
check: $(TEST_PROGS) visudo testsudoers cvtsudoers check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
diff --git a/src/Makefile.in b/src/Makefile.in
index 2785d7839..d9fa3a693 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -332,7 +332,7 @@ check-fuzzer:
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
- l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'` || true; \
+ l=`locale -a 2>&1 | $(EGREP) -i '^C\.UTF-?8$$' | $(SED) 1q` || true; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \