From bc37b6f89faf2062ed25371a90c4ceb064cd6a8f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 2 May 2017 15:02:55 +0200 Subject: 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 --- quilt/scripts/patchfns.in | 2 +- test/space-in-work-dir.test | 55 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 test/space-in-work-dir.test 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 -- cgit