From ba701a7cf8c60a85a317dcde63083fc76061c7d6 Mon Sep 17 00:00:00 2001 From: edwardsp Date: Tue, 24 May 2022 16:26:07 +0100 Subject: Update regex to correctly identify quoted args (#23494) Previously the regex was only checking for presence of quotes as a beginning or end character and not a matching set. This erroneously identified the following *single* argument as being quoted: source bashenvfile &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))" --- lib/spack/spack/util/executable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index 3457ea9bff..c424b9cdb5 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -178,7 +178,7 @@ class Executable(object): istream, close_istream = streamify(input, 'r') if not ignore_quotes: - quoted_args = [arg for arg in args if re.search(r'^"|^\'|"$|\'$', arg)] + quoted_args = [arg for arg in args if re.search(r'^".*"$|^\'.*\'$', arg)] if quoted_args: tty.warn( "Quotes in command arguments can confuse scripts like" -- cgit v1.2.3-60-g2f50