Re: [PATCH 1/3] git-p4: don't select shell mode using the type of the command argument
On Thu, Jan 6, 2022 at 7:43 AM Joel Holdsworth <jholdsworth@nvidia.com> wrote:
Show 18 quoted lines
> 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.
> ---