From: Tom Krizek Date: Wed, 12 Apr 2023 15:29:26 +0000 (+0200) Subject: Remove "which" declaration from env vars in EL8+ tests X-Git-Tag: v9.19.14~35^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68b1c6877b6cf118967728eaf2748f304cb934b3;p=thirdparty%2Fbind9.git Remove "which" declaration from env vars in EL8+ tests EL8+ systems declare "which" function using environment variables in the /etc/profile.d/which2.sh file. Because of our suboptimal environment variable detection, which is required in order to support the legacy runner, these variables are picked up by the pytest runner. If subprocesses are spawned with these environment variables set, it will cause the following issue when they spawn yet another subprocess: /bin/sh: which: line 1: syntax error: unexpected end of file /bin/sh: error importing function definition for `which' --- diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index 9bef5a1a4a3..83a01305116 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -143,6 +143,10 @@ else: for line in env_bytes.splitlines(): match = ENV_RE.match(line) if match: + # EL8+ workaround for https://access.redhat.com/solutions/6994985 + # FUTURE: can be removed when we no longer need to parse env vars + if match.groups()[0] in [b"which_declare", b"BASH_FUNC_which%%"]: + continue out[match.groups()[0]] = match.groups()[1] return out