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

Re: [PATCH v4 1/1] MacOS: precompose_argv_prefix()

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 3, 2021, 22:13 UTC
Message-ID
<xmqqh7msbxzy.fsf@gitster.c.googlers.com>
In-Reply-To
<xmqq35ydc5g3.fsf@gitster.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 28 quoted lines
> Just as the prefix-less variant was idempotent and that was the
> reason why cmd_diff_files() had its own precompose() even if the
> incoming argv[] is supposed to be already precomposed because it
> was processed in another call to precompose() in run_builtin(),
> this patch keeps these seemingly redundant calls, because it is not
> meant as a clean-up but as a bugfix for the prefix part.
>
> OK. ... Ah, no, the call in run_builtin() is a new thing.  We didn't
> have it, and the redundant call is what this patch introduced, so
> we need to be a bit more careful about the analysis here.  It is one
> thing to say "we leave the existing iffy code and address only a
> single bug" and do so.  It is entirely different to say so and then
> do "we introduce an iffy code and address only a single bug".  We
> need to admit that what we added _is_ iffy but supposed to be safe.
> Just saying "it is supposed to be safe" without saying why it is
> iffy is dishonest and does not help future developers who may want
> to jump in and clean the code.
>
> Perhaps
>
> 	Now add it into git.c::run_builtin() as well.  Existing
> 	precompose calls in diff-files.c and others would become
> 	redundant but because we do not want to make sure that there
> 	is no way for the control to reach them without passing
> 	run_builtin(), we'll keep them in place just in case.  The
> 	calls to precompose() are idempotent so it should not hurt.
>
> or something?

FYI, I've tweaked the proposed log message like the following before queuing. I think that would be explicit enough to remind us that we may be able to improve the situation fairly easily.

Thanks.
1:  071dfe8793 ! 1:  5c327502db MacOS: precompose_argv_prefix()
    @@ Commit message
     
         The original patch for preocomposed unicode, 76759c7dff53, placed
         precompose_argv() into parse-options.c
    -    Now add it into git.c (as well) for commands that don't use parse-options.
    -    Note that precompose() may be called twice - it is idempotent.
    +
    +    Now add it into git.c::run_builtin() as well.  Existing precompose
    +    calls in diff-files.c and others may become redundant, and if we
    +    audit the callflows that reach these places to make sure that they
    +    can never be reached without going through the new call added to
    +    run_builtin(), we might be able to remove these existing ones.
    +
    +    But in this commit, we do not bother to do so and leave these
    +    precompose callsites as they are.  Because precompose() is
    +    idempotent and can be called on an already precomposed string
    +    safely, this is safer than removing existing calls without fully
    +    vetting the callflows.
     
         There is certainly room for cleanups - this change intends to be a bug fix.
         Cleanups needs more tests in e.g. t/t3910-mac-os-precompose.sh, and should
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 21 of 22 in “git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)”
  1. Daniel TrogerJan 6, 2021
  2. Torsten BögershausenJan 6, 2021
  3. Daniel TrogerJan 6, 2021
  4. Torsten BögershausenJan 6, 2021
  5. Daniel TrogerJan 6, 2021
  6. Randall S. BeckerJan 6, 2021
  7. Philippe BlainJan 7, 2021
  8. Torsten BögershausenJan 7, 2021
  9. Philippe BlainJan 7, 2021
  10. Torsten BögershausenJan 8, 2021
  11. 1/1 git restore -p . and precomposed unicodetboegi@web.de, Jan 24, 2021
  12. Junio C HamanoJan 24, 2021
  13. Torsten BögershausenJan 25, 2021
  14. 1/1 MacOS: precompose_argv_prefix()tboegi@web.de, Jan 29, 2021
  15. Junio C HamanoJan 29, 2021
  16. Junio C HamanoJan 31, 2021
  17. 1/1 MacOS: precompose_argv_prefix()tboegi@web.de, Feb 2, 2021
  18. Junio C HamanoFeb 2, 2021
  19. 1/1 MacOS: precompose_argv_prefix()tboegi@web.de, Feb 3, 2021
  20. Junio C HamanoFeb 3, 2021
  21. Junio C HamanoFeb 3, 2021
  22. Torsten BögershausenFeb 5, 2021

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.