#1031835 quilt will create spurious files from certain patches on push/pop

#1031835#5
Date:
2023-02-23 22:14:03 UTC
From:
To:
Hi,

some patches imported by quilt may be patch series, which create a file in one
diff, but remove it again in another. In those cases quilt will correctly keep
the file from existing on `quilt push`. However, on `quilt pop` the spurious
file will be created. I have a minimal reproducer here:
---8<------8<------8<------8<------8<------8<------8<------8<------8<------8<---

23:01:22 [randall@batou:~/tmp] $ find
.
./tmp.patch
23:01:23 [randall@batou:~/tmp] $ cat tmp.patch
--- /dev/null
+++ b/spurious_file
@@ -0,0 +1 @@
+some content here
--- a/spurious_file
+++ /dev/null
@@ -1 +0,0 @@
-some content here
23:01:28 [randall@batou:~/tmp] $ quilt import tmp.patch
Importing patch tmp.patch (stored as tmp.patch)
23:01:32 [randall@batou:~/tmp] $ quilt push; quilt pop
Applying patch tmp.patch
patching file spurious_file
patching file spurious_file

Now at patch tmp.patch
Removing patch tmp.patch
Restoring spurious_file

No patches applied
23:01:39 [randall@batou:~/tmp] $ find
.
./.pc
./.pc/.version
./.pc/.quilt_series
./.pc/.quilt_patches
./spurious_file
./tmp.patch
./debian
./debian/patches
./debian/patches/tmp.patch
./debian/patches/series
23:01:43 [randall@batou:~/tmp] $ cat spurious_file
some content here
23:01:48 [randall@batou:~/tmp] $ rm spurious_file
23:03:07 [randall@batou:~/tmp] $ quilt push --refresh; quilt pop
Applying patch tmp.patch
patching file spurious_file
patching file spurious_file
Refreshed patch tmp.patch

Now at patch tmp.patch
Removing patch tmp.patch
Restoring spurious_file

No patches applied
23:03:23 [randall@batou:~/tmp] $ cat spurious_file
some content here
---8<------8<------8<------8<------8<------8<------8<------8<------8<------8<--- As you can see above, "spurious_file" is created after `quilt push; quilt pop`, even though it shouldn't exist (it's created on "pop"). This even persists when refreshing the patch, where it should at least drop both diffs completely. I've set the severity to important, as it breaks with the user's expectation, and potentially could cause spurious files ending up in source packages that shouldn't.