diff options
-rw-r--r-- | quilt.changes | 5 | ||||
-rw-r--r-- | quilt/scripts/patchfns.in | 31 |
2 files changed, 30 insertions, 6 deletions
diff --git a/quilt.changes b/quilt.changes index c4ca730..cffc7b8 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri May 26 12:16:18 CEST 2006 - agruen@suse.de + +- quilt/scripts/patchfns.in: Fix bugs in basename() and dirname(). + +------------------------------------------------------------------- Thu May 25 09:12:08 CEST 2006 - khali@linux-fr.org - quilt/edit.in, quilt/header.in, quilt/mail.in: Run $EDITOR with diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index 64c2a11..fa591c1 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -87,19 +87,38 @@ quote_re() basename() { - local path="${1//\/\//}" - path="${path%%/}" + local path=$1 + while [ "${path:(-1)}" = "/" ] + do + path=${path%/} + done echo "${path##*/}" } dirname() { - local path="${1//\/\//}" - path="${path%%/}" + local path=$1 + while [ "${path:(-1)}" = "/" ] + do + path=${path%/} + done local basename="${path##*/}" path="${path:0:${#path}-${#basename}}" - [ x"$path" != x"/" ] && path="${path%/}" - echo "${path:-.}" + while [ "${path:(-1)}" = "/" ] + do + path=${path%/} + done + if [ -n "$path" ] + then + echo "$path" + else + if [ ${1:0:1} = "/" ] + then + echo "/" + else + echo "." + fi + fi } patch_file_name() |