summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2017-05-02 15:02:55 +0200
committerJean Delvare <jdelvare@suse.de>2017-05-02 15:02:55 +0200
commitbc37b6f89faf2062ed25371a90c4ceb064cd6a8f (patch)
treef5bfabea9c65fbc9418884939f21293a25ad7cf0
parent102ab72dc48297be33d62dbe73536a714bcbf464 (diff)
downloadquilt-bc37b6f89faf2062ed25371a90c4ceb064cd6a8f.tar.gz
diff/refresh: Add missing quotes in basename call
The basename call in function diff_file would fail if any component of the path has a space in its name. This fixes bug #50862: https://savannah.nongnu.org/bugs/?50862 Signed-off-by: Jean Delvare <jdelvare@suse.de>
-rw-r--r--quilt/scripts/patchfns.in2
-rw-r--r--test/space-in-work-dir.test55
2 files changed, 56 insertions, 1 deletions
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index fec26ba..aaec5cb 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -705,7 +705,7 @@ diff_file()
old_hdr=$file.orig
new_hdr=$file
else
- local dir=$(basename $PWD)
+ local dir=$(basename "$PWD")
old_hdr=$dir.orig/$file
new_hdr=$dir/$file
fi
diff --git a/test/space-in-work-dir.test b/test/space-in-work-dir.test
new file mode 100644
index 0000000..234fcd3
--- /dev/null
+++ b/test/space-in-work-dir.test
@@ -0,0 +1,55 @@
+$ mkdir "work dir"
+$ cd "work dir"
+
+$ mkdir project
+$ cd project
+
+$ mkdir patches
+
+$ echo old > a
+$ quilt new 1.patch
+> Patch patches/1.patch is now on top
+
+$ quilt add a
+> File a added to patch patches/1.patch
+
+$ echo new > a
+$ quilt refresh
+> Refreshed patch patches/1.patch
+
+$ cat patches/1.patch
+> Index: project/a
+> ===================================================================
+> --- project.orig/a
+> +++ project/a
+> @@ -1 +1 @@
+> -old
+> +new
+
+$ quilt diff --no-index
+> --- project.orig/a
+> +++ project/a
+> @@ -1 +1 @@
+> -old
+> +new
+
+$ quilt pop
+> Removing patch patches/1.patch
+> Restoring a
+>
+> No patches applied
+
+$ quilt push
+> Applying patch patches/1.patch
+> patching file a
+>
+> Now at patch patches/1.patch
+
+$ quilt top
+> patches/1.patch
+
+$ quilt series -v
+> = patches/1.patch
+
+$ quilt remove a
+> File a removed from patch patches/1.patch