summaryrefslogtreecommitdiffstats
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
parent21a15e55a81ea4bd2bc21729ceebe6be6a9ccd9b (diff)
downloadquilt-82784f00b124b6fb7d431036ac284289ffe22356.tar.gz
Fix buggy regex quoting; another Autoconf change in Makefile.
-rw-r--r--Makefile19
-rw-r--r--TODO6
-rw-r--r--quilt.changes3
-rw-r--r--quilt/import.in3
-rw-r--r--quilt/new.in2
-rw-r--r--scripts/patchfns.in15
6 files changed, 33 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 4b527ed..5b41061 100644
--- a/Makefile
+++ b/Makefile
@@ -77,7 +77,8 @@ rpm : $(PACKAGE)-$(VERSION).tar.gz
rpm -tb $<
doc/README : doc/README.in
- @awk '/@REFERENCE@/ { system("$(MAKE) -s reference") ; next }'$$'\n'' \
+ @awk '/@REFERENCE''@/ { system("$(MAKE) -s reference") ; \
+ next }'$$'\n'' \
{ print }' 2>&1 $< > $@
.PHONY :: reference
@@ -147,13 +148,13 @@ clean distclean :
% : %.in
@echo "$< -> $@"
- @sed -e "s:@LIB@:$(LIB_DIR):g" \
- -e "s:@QUILT@:$(QUILT_DIR):g" \
- -e "s:@SCRIPTS@:$(SCRIPTS_DIR):g" \
- -e "s:@PERL@:$(PERL):g" \
- -e "s:@BASH@:$(BASH):g" \
- -e "s:@DIFF@:$(DIFF):g" \
- -e "s:@PATCH@:$(PATCH):g" \
- -e "s:@MKTEMP@:$(MKTEMP):g" \
+ @sed -e 's:@LIB''@:$(LIB_DIR):g' \
+ -e 's:@QUILT''@:$(QUILT_DIR):g' \
+ -e 's:@SCRIPTS''@:$(SCRIPTS_DIR):g' \
+ -e 's:@PERL''@:$(PERL):g' \
+ -e 's:@BASH''@:$(BASH):g' \
+ -e 's:@DIFF''@:$(DIFF):g' \
+ -e 's:@PATCH''@:$(PATCH):g' \
+ -e 's:@MKTEMP''@:$(MKTEMP):g' \
$< > $@
@chmod --reference=$< $@
diff --git a/TODO b/TODO
index 07421ad..7e3b86e 100644
--- a/TODO
+++ b/TODO
@@ -34,6 +34,12 @@ General:
- Add option for creating hard links.
+ - Instead of passing around and storing in applied-patches the
+ short patch name (=patch file name with .dif .diff .patch .gz
+ .bz2 stripped), translate from short names to real file names
+ an the user interface, and work with full names internally.
+ This will simplify regexp matching in several functions.
+
Documentation:
- How to rediff with pushpatch -f / poppatch -f?
diff --git a/quilt.changes b/quilt.changes
index 9021f70..951c7ef 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -6,6 +6,9 @@ Fri Jan 31 13:05:18 CET 2003 - agruen@suse.de
in /usr/lib/quilt/, and install the scripts in
/usr/share/quilt/scripts/, so that no binaries are installed
under /usr/share.
+- Fix quoting strings for inclusion in regular expressions.
+- Change literal '@SUBST@' strings in Makefile to '@SUBST''@',
+ so that Autoconf won't mess them up later.
-------------------------------------------------------------------
Fri Jan 31 09:15:01 +0100 2003 - Martin.Quinson@ens-lyon.fr
diff --git a/quilt/import.in b/quilt/import.in
index f201a7d..0526e42 100644
--- a/quilt/import.in
+++ b/quilt/import.in
@@ -58,7 +58,8 @@ do
case "$1" in
-n)
opt_patch=$(echo "$2" |
- sed -e 's:^'"$P"'patches/::' -e 's:^\.pc/::')
+ sed -e 's/^'"$(quote_bre $P)"'patches\///' \
+ -e 's/^\.pc\///')
shift 2 ;;
-p)
opt_strip=$2
diff --git a/quilt/new.in b/quilt/new.in
index 316efcb..dacd492 100644
--- a/quilt/new.in
+++ b/quilt/new.in
@@ -59,7 +59,7 @@ then
usage
fi
-patch_file=$(echo $1 | sed -e 's:^'"$P"'patches/::')
+patch_file=$(echo $1 | sed -e 's/^'"$(quote_bre $P)"'patches\///')
patch=$(stripit $patch_file)
if patch_in_series $patch
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()