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

Re: WMLOPTS quoting bug in WML 1.7.4



On 11 Oct 1999, Hans Ulrich Niedermann wrote:

> Hi,
> 
> this time it is a real bug, I'm sure :-)

You're right.

> [uli@chef ~]$ touch test.wml
> [uli@chef ~]$ WMLOPTS='-DX=1 \"-DXY=2\"' wml test.wml
> ** Slice:Warning: no such slice 'ALL'
> [uli@chef ~]$ WMLOPTS='-DX=1 "-DXY=2"' wml test.wml
> 
> And now, nothing happens. 100% CPU load and nothing else. So I
> cancelled with Ctrl-C.
> 
> [uli@chef ~]$ ll test.*
> -rw-rw-r--   1 uli      uli             0 Okt 11 02:15 test.wml
> [uli@chef ~]$ 
> 
> Still using wml 1.7.4, patched from 1.7.3 source-tarball. If the guy
> "fixing" the "quotes in WMLOPTS" bug wants to handle that: You're
> welcome :-) (You probably know where to look). Else I'll be looking
> after it during the next few days.

Below is a patch.

Thanx for your report.

--- wml.src	1999/09/30 09:28:07	1.31
+++ wml.src	1999/10/11 07:00:07
@@ -190,8 +190,10 @@
     my ($str) = @_;
     my (@argv) = ();
     my ($r) = '';
+    my ($prev) = '';
 
     while (1) {
+        $prev = $str;
         next if $str =~ s|^"([^"\\]*(?:\\.[^"\\]*)*)"(.*)$|$r .= $1, $2|e;
         next if $str =~ s|^'([^'\\]*(?:\\.[^'\\]*)*)'(.*)$|$r .= $1, $2|e;
         next if $str =~ s|^([^\s"']+)(.*)$|$r .= $1, $2|e;
@@ -203,6 +205,11 @@
             $str =~ s|^[\s\n]+||;
             last if ($str eq '');
         }
+        if ($str eq $prev) {
+            #    breaks an infinite loop
+            print STDERR "** WML:Error: options can not be correctly parsed\n";
+            exit(1);
+        }
     }
     return @argv;
 }
@@ -230,8 +230,9 @@
     &verbose(2, "Reading WMLOPTS variable");
     $var =~ s|^\s+||;
     $var =~ s|\s+$||;
+    $var =~ s|\$|\\\$|g;
     @ARGV = ();
-    @X = &split_argv(&quotearg($var));
+    @X = &split_argv($var);
     push(@ARGV, @X);
     &ProcessOptions();
 }

-- 
Denis Barbier
WML Maintainer

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com