quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH 5/7] setup: Fix white space handling by check_for_exi


From: Jean Delvare
Subject: [Quilt-dev] [PATCH 5/7] setup: Fix white space handling by check_for_existing_files
Date: Sun, 21 Oct 2012 14:32:01 +0200

Fix handling of directory names including white spaces by
check_for_existing_files. awk can't deal with tokens which include
white spaces, so use bash's read function instead.

As a side bonus, we get rid of the undocumented dependency to "uniq".
---
 quilt/setup.in |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -23,9 +23,12 @@ then
 fi
 
 check_for_existing_files() {
-       local dir status=0
-       for dir in $(awk ' $1 == "patch" { print $2 }' $tmpfile | uniq)
+       local tag dir last_dir arg status=0
+
+       while read tag dir arg
        do
+               [ "$tag" = "patch" -a "$dir" != "$last_dir" ] || continue
+
                if [ -e "$prefix$dir/$QUILT_PATCHES" ]
                then
                        printf $"Directory %s exists\n" \
@@ -38,7 +41,9 @@ check_for_existing_files() {
                               "$prefix$dir/$QUILT_SERIES" >&2
                        status=1
                fi
-       done
+               last_dir=$dir
+       done < $tmpfile
+
        return $status
 }
 

-- 
Jean Delvare
Suse L3




reply via email to

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