quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] diff/refresh: Add missing quotes in basename call


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] diff/refresh: Add missing quotes in basename call
Date: Wed, 26 Apr 2017 14:31:05 +0200

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

Let's also fix a similar situation in a dirname call in function
insert_in_series.

Signed-off-by: Jean Delvare <address@hidden>
---
 quilt/scripts/patchfns.in   |    4 +--
 test/space-in-work-dir.test |   57 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 2 deletions(-)

--- quilt.orig/quilt/scripts/patchfns.in        2017-04-26 14:20:15.179268498 
+0200
+++ quilt/quilt/scripts/patchfns.in     2017-04-26 14:20:24.372372239 +0200
@@ -240,7 +240,7 @@ insert_in_series()
        fi
 
        tmpfile=$(gen_tempfile) || return 1
-       mkdir -p $(dirname $SERIES)
+       mkdir -p "$(dirname "$SERIES")"
        if [ -n "$before" ]
        then
                awk '
@@ -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
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ quilt/test/space-in-work-dir.test   2017-04-26 14:29:04.652238033 +0200
@@ -0,0 +1,57 @@
+$ 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
+
+$ quilt diff


-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]