Subject: bug#66095: [bug-diffutils] bug#66095: diff quoting for names with spaces changed after v3.10-171-g69ae797392

From: Andreas Grünbacher <[email-masked]>
Date: Tue, 19 Sep 2023 14:05:39 +0200

Hello Paul,

I don't know how this change could end up being applied to diffutils,
but commit 69ae797 ("cmp,diff,diff3,sdiff: quote more consistently")
breaks compatibility with GNU patch  and other consumers without a
discussion, warning, or lead time to at least adjust all the major
consumers first. That's not acceptable, so could you please revert
this change?

The particular quoting style that you seem to object to was introduced
in commit e17295d ("diff: encode file names with special characters").
At the time, "git diff" had already been using this format for years,
so there was already considerable precedent for not inventing
something new. And I believe this argument still applies.

Thanks,
Andreas

Am Di., 19. Sept. 2023 um 00:13 Uhr schrieb Gleb
Fotengauer-Malinovskiy <[email-masked]>:
>
> Hi,
>
> Following the commit v3.10-171-g69ae797392 ("cmp,diff,diff3,sdiff: quote
> more consistently") the quoting changed as follows:
>
> $ diff --version | head -1
> diff (GNU diffutils) 3.10.171-69ae7
> $ diff -u with\ space/1 with\ space/2
> --- 'with space/1'      1970-01-01 00:00:00.000000000 +0000
> +++ 'with space/2'      1970-01-01 00:00:00.000000000 +0000
> @@ -1 +1 @@
> -1
> +2
>
> In the previous commit, it appeared as follows:
>
> $ diff --version | head -1
> diff (GNU diffutils) 3.10.170-23d50
> $ diff -u with\ space/1 with\ space/2
> --- "with space/1"      1970-01-01 00:00:00.000000000 +0000
> +++ "with space/2"      1970-01-01 00:00:00.000000000 +0000
> @@ -1 +1 @@
> -1
> +2
>
> Unlike the old quoting (with quotation marks), the new quoting (with
> apostrophes) is not supported by GNU patch:
>
> can't find file to patch at input line 3
> Perhaps you used the wrong -p or --strip option?
> The text leading up to this was:
> --------------------------
> |--- 'with space/1'     1970-01-01 00:00:00.000000000 +0000
> |+++ 'with space/2'     1970-01-01 00:00:00.000000000 +0000
> --------------------------
> File to patch:
> Skip this patch? [y]
> Skipping patch.
> 1 out of 1 hunk ignored
>
>
> This regression was discovered using the Quilt testsuite:
>
> [124] $ quilt push -qa -- failed
> Applying patch patches/foo.diff       == Applying patch patches/foo.diff
> The text leading up to this was:      != Applying patch patches/revert.diff
> --------------------------            != Applying patch patches/again.diff
> |--- 'space [dir]/foo.orig'     2023-09-15 18:02:57.623257723 +0000 != Now at patch patches/again.diff
> |+++ 'space [dir]/foo'  2023-09-15 18:02:57.625257744 +0000 != ~
> --------------------------            != ~
> No file to patch.  Skipping patch.    != ~
> 1 out of 1 hunk ignored               != ~
> Patch patches/foo.diff does not apply (enforce with -f) != ~
> [129] $ cd .. -- ok
> [130] $ rm -rf "space [dir]" -- ok
> 64 commands (63 passed, 1 failed)
> make: *** [Makefile:412: test/.setup.ok] Error 1
>
> --
> glebfm
>
>
>