Re: [PATCH 2/2] diff: --quote-path-with-sp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 15 2021, Junio C Hamano wrote:

[CC-ing Andreas Gruenbacher who's currently active in GNU patch
development, and Paul Eggert at his current address, in case he's
curious about this blast from the past.

Both: The full context for this proposed change in Git is at
https://lore.kernel.org/git/20210915223316.1653443-1-gitster@xxxxxxxxx/]

> Long time ago, we had a discussion with GNU patch/diff maintainer
> and agreed that pathnames with certain "difficult" bytes needs to be
> quoted to ensure the resulting patch is machine parseable in an
> unambiguous way [*1*].  Recently, we saw a report that found that
> GNU patch is unhappy with our diff output for a path with SP in it
> [*2*].

It would also be good to mention 4f6fbcdcf96 (Functions to quote and
unquote pathnames in C-style., 2005-10-14) here, which is what came out
of the [*1*] discussion you're citing, and that also link to the later:

    https://lore.kernel.org/git/7vll0wvb2a.fsf@xxxxxxxxxxxxxxxxxxxxxxxx/

Where you quote a message of Paul Eggert's that didn't make it into the
archive, but which AFAICT accurately summarizes the behavior in
4f6fbcdcf96.

Whereas the [*1*] you linked to is still the early proposal of handling
UTF-8 specially (not quoting it), which doesn't appear to be what either
GNU patch or Git went for in the end (both fully quote some fairly
vanilla (also in latin1) UTF-8 when I tested it).

It's still not clear to me if what was agreed upon was accurately
implemented by Git at the time, but that GNU patch had a bug vis-a-vis
the desired discussed behavior, if the bug is Git's, or both etc. Does a
fix still need to be made in GNU patch?

There's also a mention of busybox's interaction with this behavior in
https://lore.kernel.org/git/YUK7Bl9uzNE1YErg@xxxxxxxxxx/; has anyone
(you or Gwyneth) sent them an FYI about this in case they'd like to
adjust the behavior of their patch tool?

> Teach "git diff" and friends the "--quote-path-with-sp" option, that
> encloses a pathname with SP in it inside a pair of double-quotes,
> even though there is otherwise no byte in the pathname that need to
> be encoded in the octal.
>
> As an earlier parts of t/t3902 (outside the patch context) shows,
> output from "ls-files", "ls-tree", and "diff --name-only" all follow
> the same rule to decide paths with what bytes in them need quoting
> and how they are quoted.
>
> This experimental option deliberately refrains from touching these
> output and affects ONLY the paths that appear in the patch header,
> i.e. "diff --git", "--- a/path" and "+++ b/path" lines, that GNU
> patch may care.  This is to minimize potential damage this change
> may cause to tools and scripts the users have been relying on.
>
>  *1* https://lore.kernel.org/git/87ek6s0w34.fsf@xxxxxxxxxxxxxxxxxxx/
>  *2* https://lore.kernel.org/git/YR9Iaj%2FFqAyCMade@xxxxxxxxxx/
> [...patch omitted...]



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux