git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] git-p4: don't select shell mode using the type of the command argument

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 6, 2022, 17:02 UTC
Message-ID
<CAPig+cTN933GO42m10qbABz8gX61d2uKDJWQmYHYCCar5rgFSA@mail.gmail.com>
In-Reply-To
<20220105161451.56378-2-jholdsworth@nvidia.com>
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.
> ---
Missing sign-off.
Previous: Joel HoldsworthNext: Joel Holdsworth
Message 3 of 6 in “git-p4: Rationalise command construction”
  1. 0/3 git-p4: Rationalise command constructionJoel Holdsworth, Jan 5, 2022
  2. 1/3 git-p4: don't select shell mode using the type of the command argumentJoel Holdsworth, Jan 5, 2022
  3. Eric SunshineJan 6, 2022
  4. 2/3 git-p4: pass command arguments as lists instead of using shellJoel Holdsworth, Jan 5, 2022
  5. 3/3 git-p4: don't print shell commands as python listsJoel Holdsworth, Jan 5, 2022
  6. Eric SunshineJan 6, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.