[Po4a-commits] "po4a changelog,1.200,1.201 po4a,1.77,1.78"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Mon Jul 2 22:55:23 UTC 2007


Update of /cvsroot/po4a/po4a
In directory alioth:/tmp/cvs-serv29028

Modified Files:
	changelog po4a 
Log Message:
Fix infinite loop when an option argument specified in a config file
contains single quotes.


Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- po4a	29 Apr 2007 22:57:27 -0000	1.77
+++ po4a	2 Jul 2007 22:55:21 -0000	1.78
@@ -714,14 +714,17 @@
     my @opts = ();
     $options =~ s/\\"/"/g;
     while (length $options) {
-        $options =~ s/^(["'])                   # A quote
-                        ((?:\\.|(?!\1)[^\\])*)  # quoted text
-                        \1                      # The same quote
-                      |
-                      ^((?:\\.|[^\\"'])*?)      # unquoted word
-                      ([ ]|$)                   # space is the separator
-                     //xs;                      # extended regex
-        push @opts, (defined $1?$2:$3);
+        my $o = "";
+        while (length $options and $options !~ /^ /s) {
+            # Extract non quoted parts
+            $options =~ s/^([^\\"' ]*)//s;
+            $o .= $1 if defined $1;
+            # And extract quoted parts
+            $options =~ s/^(["'])((?:\\.|(?!\1)[^\\])*)\1//s;
+            $o .= $2 if defined $2;
+        }
+        $options =~ s/^ *//s;
+        push @opts, $o;
     }
 
     return @opts;

Index: changelog
===================================================================
RCS file: /cvsroot/po4a/po4a/changelog,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- changelog	17 Jun 2007 00:19:39 -0000	1.200
+++ changelog	2 Jul 2007 22:55:21 -0000	1.201
@@ -1,3 +1,9 @@
+2007-07-03  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* po4a: Support quoted parts inside option arguments. This fixes
+	infinite loop when a config file contains an argument with single
+	quotes (which are not surrounding quotes).
+
 2007-06-17  Nicolas François  <nicolas.francois at centraliens.net>
 
 	Merge some changes introduced in the Debian 0.31-1 package:




More information about the Po4a-commits mailing list