Subject: diff quoting for names with spaces changed after v3.10-171-g69ae797392

From: Gleb Fotengauer-Malinovskiy <[email-masked]>
Date: Tue, 19 Sep 2023 01:00:52 +0400

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