[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: [BUG REPORT] WML 2.0.2, Linux 2.0.36
- From: Denis Barbier <nospam@thanx>
- Date: Tue, 17 Apr 2001 00:56:40 +0200
On Tue, Apr 10, 2001 at 05:45:49PM +0200, Aymeric.PoulainMaubant@jipo.comNOSPAMPLEASE wrote:
> BUG REPORT
>
> Package: WML 2.0.2
> Operating System: Linux 2.0.36
>
> Problem Description:
> | Short Description : when a source file contains a
> | <protect 9> zone, its code is never dumped on
> | STDOUT if ones want to dump on STDOUT and on
> | a classical outputfile.
> |
> |
> | [nota. I checked more recent versions of WML (>2.02)
> | and the bug listed below is still there]
> |
> | Long Description, and hack :
> |
> | Try to wml this file :
> | -------------------%<---------------
> | #!wml --outputfile=ALL:- --outputfile=ALL:protect9.html
> |
> | aaa
> |
> | <protect pass=9>
> | bbb
> | </protect>
> | -------------------%<---------------
> |
> | This gives :
> |
> | ----------------------
> | % wml protect9.wml
> | aaa
> | -=P[000000]=-
> | % more protect9.html
> | aaa
> |
> | bbb
> | %
> | ----------------------
> |
> | See what happens ? The <protect 9> part dumped
> | to STDOUT get never unprotected.
> |
> | This happens only when one wants a STDOUT && one
> | or more classical outputfiles in the same run.
> | This is due to the fact that in the wml frontend,
> | the subroutine ProcessOutfiles does not treat STDOUT
> | fairly, imho : STDOUT is not included in the
> | @outfiles array.
Good catch, Aymeric.
Here is a slightly modified patch (against current CVS version), i find
it a little bit simpler.
Thanks for your help.
--
Denis Barbier
WML Maintainer
Index: wml.src
===================================================================
RCS file: /home/barbier/Projets/Wml/cvs/wml/wml_frontend/wml.src,v
retrieving revision 1.68
diff -u -u -r1.68 wml.src
--- wml.src 2001/02/21 00:11:11 1.68
+++ wml.src 2001/04/16 22:42:21
@@ -868,10 +868,10 @@
}
close(SLICE);
if ($#ARGV > -1) {
+ $out_istmp = 0;
&ProcessOptions();
&ProcessOutfiles();
$opt = "$verbose $out";
- $out_istmp = 0;
}
@ARGV = @ARGVLINE;
}
@@ -990,6 +990,15 @@
unshift(@opt_D, "WML_VERSION=$VERSION");
unshift(@opt_D, "WML_TMPDIR=$tmpdir");
+# Create temporary file names as soon as $src_suffix is set
+$tmp[0] = "$tmpdir/wml.$$.tmp1" . $src_suffix;
+$tmp[1] = "$tmpdir/wml.$$.tmp2" . $src_suffix;
+$tmp[2] = "$tmpdir/wml.$$.tmp3" . $src_suffix;
+$tmp[3] = "$tmpdir/wml.$$.tmp4" . $src_suffix;
+
+# Flag set if some output goes to stdout
+$out_istmp = 0;
+
#
# generate options
#
@@ -1090,26 +1099,31 @@
$out = '';
@outfiles = ();
foreach $o (@opt_o) {
- next if ($o eq '-' || $o =~ m|\*[^:]*$|);
+ next if ($o =~ m|\*[^:]*$|);
# create option
- $out .= " -o '"."earg($o)."'";
+ if ($o eq '-' or $o =~ m/:-$/) {
+ $out .= " -o '"."earg($tmp[3])."'";
+ $out_istmp = 1;
+ } else {
+ $out .= " -o '"."earg($o)."'";
+ }
# unquote the filename
$o =~ s|^(['"])(.*)\1$|$2|;
# create output file list for epilog filters
if ($o =~ m|^([_A-Z0-9~!+u%n\-\\^x*{}()@]+):(.+)\@(.+)$|) {
- push(@outfiles, $2) if ($2 ne '-');
+ push(@outfiles, ($2 ne '-' ? $2 : $tmp[3]));
}
elsif ($o =~ m|^([_A-Z0-9~!+u%n\-\\^x*{}()@]+):(.+)$|) {
- push(@outfiles, $2) if ($2 ne '-');
+ push(@outfiles, ($2 ne '-' ? $2 : $tmp[3]));
}
elsif ($o =~ m|^(.+)\@(.+)$|) {
- push(@outfiles, $1) if ($1 ne '-');
+ push(@outfiles, ($1 ne '-' ? $1 : $tmp[3]));
}
else {
- push(@outfiles, $o) if ($o ne '-');
+ push(@outfiles, ($o ne '-' ? $o : $tmp[3]));
}
}
}
@@ -1125,12 +1139,6 @@
$optimize = "-O$opt_O";
}
-# Add the original suffix to temporary files
-$tmp[0] = "$tmpdir/wml.$$.tmp1" . $src_suffix;
-$tmp[1] = "$tmpdir/wml.$$.tmp2" . $src_suffix;
-$tmp[2] = "$tmpdir/wml.$$.tmp3" . $src_suffix;
-$tmp[3] = "$tmpdir/wml.$$.tmp4" . $src_suffix;
-
if (not $src_istmp) {
# Input file is copied because of the protect/unprotect stuff
$fpin = new IO::File;
@@ -1153,7 +1161,6 @@
$cnt = 0;
}
-$out_istmp = 0;
if ($out eq '') {
$out = " -o$tmp[3]";
$out_istmp = 1;
@@ -1293,7 +1300,7 @@
}
close(FP);
}
-elsif ($out_istmp) {
+if ($out_istmp) {
&unprotect($tmp[3], 9);
open(FP, "<$tmp[3]");
while (<FP>) {
@@ -1301,7 +1308,7 @@
}
close(FP);
}
-elsif ($#outfiles > -1) {
+if ($#outfiles > -1) {
# unprotect all outputfiles
foreach $o (@outfiles) {
&unprotect($o, 9);