summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-01-31 17:06:26 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-01-31 17:06:26 +0000
commit82784f00b124b6fb7d431036ac284289ffe22356 (patch)
tree33cff875bf9a9f3f420d5cc6ef0b0c38c924ba60 /scripts
parent21a15e55a81ea4bd2bc21729ceebe6be6a9ccd9b (diff)
downloadquilt-82784f00b124b6fb7d431036ac284289ffe22356.tar.gz
Fix buggy regex quoting; another Autoconf change in Makefile.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/patchfns.in15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index e17d164..57a3ab2 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -29,9 +29,16 @@ DB=".pc/applied-patches"
# Define where diffstat lives (may be missing)
DIFFSTAT=/usr/bin/diffstat
+# Quote a string for use in a basic regular expression.
+quote_bre()
+{
+ echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g'
+}
+
+# Quote a string for use in an extended regular expression.
quote_re()
{
- echo "$1" | sed -e 's:\([\^\$/.+*\[\\]\):\\\1:g'
+ echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g'
}
#basename()
@@ -434,7 +441,7 @@ stripit()
then
echo $1 |
sed -e 's/^\(\.\/\)*//' \
- -e 's/^'"$P"'patches\///' -e 's/^\.pc\///' \
+ -e 's/^'"$(quote_bre $P)"'patches\///' -e 's/^\.pc\///' \
-e 's/\.gz$//' -e 's/\.bz2$//' \
-e 's/\.patch$//' -e 's/\.diff\?$//'
fi
@@ -536,8 +543,8 @@ diff_file()
fix_diff_header()
{
local from=$1 to=$2
- sed -e 's:^--- [^ \t]*:--- '"$from"':' \
- -e 's:^+++ [^ \t]*:+++ '"$to"':'
+ sed -e 's/^--- [^ \t]*/--- '"$(quote_bre $from)"'/' \
+ -e 's/^+++ [^ \t]*/+++ '"$(quote_bre $to)"'/'
}
cat_file()