#213041 wml_p1_ipp: allow quotes in variable substitutions

Package:
wml
Source:
wml
Submitter:
Vincent Sanders
Date:
2010-03-07 13:36:08 UTC
Severity:
wishlist
#213041#5
Date:
2003-04-10 17:03:53 UTC
From:
To:
The pass 1 preprocessor provides a dependancy generation facility,
using --depends=D , uses teh passed in filename and changes its
extension to .d for the output filename, however this functionality is
broken. A file names one.two.three would have an output filename of
one.d and not one.two.d

The second issue is that variable setting currently cannot contain
the " character which is wrong, the attached patch fixes this and
allows for \" to include " charaters in variables.
--- /usr/lib/wml/exec/wml_p1_ipp-orig	2003-04-10 17:41:20.000000000 +0100
+++ /usr/lib/wml/exec/wml_p1_ipp	2003-04-10 17:24:42.000000000 +0100
@@ -145,8 +145,9 @@
     while ($str) {
         $str =~ s|^\s+||;
         last if ($str eq '');
-        if ($str =~ s|^([a-zA-Z][a-zA-Z0-9_]*)="([^"]*)"||) {
-            $arg->{$1} = $2;
+
+        if ($str =~ s/^([a-zA-Z][a-zA-Z0-9_]*)="((?:\\\\|\\"|[^"])*)"//) {
+             my ($x, $y) = ($1, $2); $y =~ s/\\([\\"])/$1/g; $arg->{$x} = $y;
         }
         elsif ($str =~ s|^([a-zA-Z][a-zA-Z0-9_]*)=(\S+)||) {
             $arg->{$1} = $2;
@@ -634,7 +635,7 @@
 if ($opt_M ne '-' && $opt_o ne '-') {
     #   Write dependencies
     if ($opt_M =~ m|D|) {
-        if ($opt_o =~ m|(.*?)\.|) {
+        if ($opt_o =~ m|(.*)\.|) {
             $depfile = $1 . '.d';
         }
         else {

#213041#10
Date:
2003-04-10 19:23:17 UTC
From:
To:
Right, I will apply your patch.

Very well done, it looks fine ;)
I will fix this problem too, thanks for your report.

Denis

#213041#15
Date:
2003-09-27 21:30:28 UTC
From:
To:
On Thu, Apr 10, 2003 at 09:23:17PM +0200, Denis Barbier wrote:
[...]
I am preparing a new upload, but will discard this fix because
backslash may appear in some locales (like iso-2022-jp) and so
must not be removed; see e.g. the first line of
http://cvs.debian.org/webwml/japanese/News/weekly/2000/10/index.wml?rev=1.8&cvsroot=webwml&content-type=text/vnd.viewcvs-markup
Moreover this fix is fragile:
  $ cat test.1
  in test.1: $(FOO)
  #include "test.2" FOO="$(FOO)"
  $ cat test.2
  in test.2: $(FOO)
  $ /usr/lib/wml/exec/wml_p1_ipp -N -DFOO='a"b' test.1
  in test.1: a"b
  in test.2: a
So quotes need to be escaped somewhere, but I am reluctant to make such
changes.

Denis