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)))"
This commit is contained in:
@@ -178,7 +178,7 @@ def streamify(arg, mode):
|
|||||||
istream, close_istream = streamify(input, 'r')
|
istream, close_istream = streamify(input, 'r')
|
||||||
|
|
||||||
if not ignore_quotes:
|
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:
|
if quoted_args:
|
||||||
tty.warn(
|
tty.warn(
|
||||||
"Quotes in command arguments can confuse scripts like"
|
"Quotes in command arguments can confuse scripts like"
|
||||||
|
|||||||
Reference in New Issue
Block a user