]> git.ipfire.org Git - thirdparty/git.git/commit
git-p4: don't select shell mode using the type of the command argument
authorJoel Holdsworth <jholdsworth@nvidia.com>
Thu, 6 Jan 2022 21:40:33 +0000 (21:40 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Jan 2022 22:55:12 +0000 (14:55 -0800)
commit3d8a3038bce2b13faeca0b776efa896d1c0d0b49
treecebbc237d23a29c3a9fa52656f00db7ac7a015cd
parente83ba647f7c61cf945690d6a0bd8c172a6498dc8
git-p4: don't select shell mode using the type of the command argument

Previously, the script would invoke subprocess functions setting the
shell argument True if the command argument was a string, setting it
False otherwise.

This patch replaces this implicit type-driven behaviour with explicit
shell arguments specified by the caller.

The apparent motive for the implict behaviour is that the subprocess
functions do not divide command strings into args. Invoking
subprocess.call("echo hello") will attempt to execute a program by the
name "echo hello". With subprocess.call("echo hello", shell=True), sh
-c "echo hello" will be executed instead, which will cause the command
and args to be divided by spaces.

Eventually, all usage of shell=True, that is not necessary for some
purpose beyond parsing command strings, should be removed. For now,
this patch makes the usage of shells explicit.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py