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

Re: [PATCH try2 0/4] completion: bash: a bunch of fixes

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 23, 2020, 14:31 UTC
Message-ID
<5fe354c91a6f7_198be208d8@natae.notmuch>
In-Reply-To
<20201223141950.GA23264@szeder.dev>
SZEDER Gábor wrote:
> On Wed, Dec 23, 2020 at 07:38:12AM -0600, Felipe Contreras wrote:
Show 21 quoted lines
> > and in zsh, this:
> > 
> >   local sfx
> >   echo "'${sfx- }'"
> > 
> > Prints an empty string.
> > 
> > That's because in zsh "local sfx" is effectively "local sfx=''" which in
> > my opinion is a bug.
> 
> Bash versions up to 4.0-alpha suffered from this bug as well; I believe
> the relevant changelog entry for 4.0-beta is this:
> 
>   e.  Fixed a bug that caused local variables to be created with the empty
>       string for a value rather than no value.
> 
> So the default Bash version on macOS still has this bug, thus
> __gitcomp_nl_append() is invoked with an empty string sfx parameter
> instead of a space, causing the test failure.  I can reproduce the
> test failure on Linux using Bash v3.2 (and v3.1 and v3.0), and it
> passes with v4.0 and later versions.
Ahhh, interesting.
So I'm not the only one who considers it a bug.
Show 15 quoted lines
> > I see 5 courses of action:
> > 
> >  1. Drop the offending patch: this is wrong because the bug is still
> >     there, we are just not checking for it.
> >  2. Add a BASH prereq just for that test, or test_expect_unstable (we
> >     would need to add extra code for both of those).
> >  3. Add the fix, but not the test for the fix.
> 
> I'm for this option 3: this patch does fix a bug for users of Bash
> v4.0 or later, while it doesn't change the behavior with v3.2 or
> earlier (and with zsh, if I understand correctly).  OTOH, the test
> doesn't seem to be all that useful: while it does demonstrate the
> issue, it checks only one of those callsites that passed the wrong
> suffix, and, more importantly, it doesn't protect us from adding
> another callsites with similarly wrong suffex in the future.
I'm fine with that option.
> In any case, the commit message should note that the fix doesn't work
> with all Bash versions and why.
Yes. I will send a re-roll (unless somebody objects beforehand).
-- 
Felipe Contreras
Previous: SZEDER GáborNext: Junio C Hamano
Message 9 of 11 in “completion: bash: a bunch of fixes”
  1. 0/4 completion: bash: a bunch of fixesFelipe Contreras, Dec 19, 2020
  2. 1/4 completion: bash: fix prefix detection in branch.*Felipe Contreras, Dec 19, 2020
  3. 2/4 completion: bash: add correct suffix in variablesFelipe Contreras, Dec 19, 2020
  4. 4/4 completion: bash: fix for multiple dash commandsFelipe Contreras, Dec 19, 2020
  5. 3/4 completion: bash: fix for suboptions with valueFelipe Contreras, Dec 19, 2020
  6. Junio C HamanoDec 23, 2020
  7. Felipe ContrerasDec 23, 2020
  8. SZEDER GáborDec 23, 2020
  9. Felipe ContrerasDec 23, 2020
  10. Junio C HamanoDec 23, 2020
  11. Felipe ContrerasDec 24, 2020

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.