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

Re: [PATCH 1/2] completion: quote arguments of test and [

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 24, 2023, 13:43 UTC
Message-ID
<6446876d2e22b_aba294a5@chronos.notmuch>
In-Reply-To
<xmqqh6ta3485.fsf@gitster.g>
Junio C Hamano wrote:
Show 15 quoted lines
> Koichi Murase <myoga.murase@gmail.com> writes:
> 
> > The raw command substitutions $v in the arguments of the test command
> > and the [ command are subject to word splitting and pathname
> > expansions. Even when it is ensured that the variable is not empty and
> > does not contain whitespaces and glob characters, it can fail when IFS
> > is set to non-trivial values containing letters and digits.
> 
> The above sounded good before I looked at the patch, and it still is
> good in theory, but it start to look mostly academic especially with
> enclosing $# inside a pair of double-quotes, and the variable would
> have only digits.  The same for $i and $j that appear in the loop
> control "for ((i=0, j=0; ...)); do".  The story is pretty much the
> same for local variables we set outselves to signal our findings,
> like $pcmode that is only set to either 'yes' or 'no'.
I do have the same opinion.

Although the result seems more proper, I fail to see the actual value of doing all these changes everywhere.

On the other hand I do see the very real harm that they would break the git-completion branch everywhere. Rebasing those 50-so patches would not be very pleasant.

> In other words, this patch looks way too noisy to be reviewed to
> discover its real worth.
Agreed.
-- 
Felipe Contreras
Previous: Koichi Murase
Message 10 of 10 in “completion: quote arguments of test and [”
  1. 1/2 completion: quote arguments of test and [Koichi Murase, Apr 20, 2023
  2. 2/2 completion: suppress unwanted unescaping of `read`Koichi Murase, Apr 20, 2023
  3. Junio C HamanoApr 20, 2023
  4. Koichi MuraseApr 20, 2023
  5. completion: suppress unwanted unescaping of `read`Koichi Murase, Apr 20, 2023
  6. Junio C HamanoApr 20, 2023
  7. Felipe ContrerasApr 24, 2023
  8. Junio C HamanoApr 20, 2023
  9. Koichi MuraseApr 20, 2023
  10. Felipe ContrerasApr 24, 2023

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.