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

Re: parent dir breaks Diversion



On Fri, Apr 27, 2001 at 03:00:26PM +0900, Nobuyuki Tsuchimura wrote:
>   Hi,
> 
> >   I found a bug in wml-2.1a1 (also in SNAP).
> > 
> > ---- input
> > <<head>>
> > ..head>>This is OK.<<..
> > <a href="../">Parent dir</a>
> > ..head>>This is NG.<<..
> 
> >   I made a patch, but I'm not good at perl,
> > so please take care.
> > 
> > --- /usr/lib/wml/exec/wml_p5_divert.orig	Fri Apr 27 02:44:37 2001
> > +++ /usr/lib/wml/exec/wml_p5_divert	Fri Apr 27 02:52:35 2001
> > @@ -203,9 +203,12 @@
> >          #   calculate the minimum amount of plain characters we can skip
> >          my $l = length($remain);
> >          my $i1 = index($remain, '<<');  $i1 = ($i1 == -1 ? $l : $i1);
> > -        my $i2 = index($remain, '..');
> > +        my $i2 = -1;
> >          #   Skip ../ which is often used in URLs
> > -        $i2 = $l if ($i2 == -1 or substr($remain, $i2+2, 1) eq '/');
> > +        do {
> > +            $i2 = index($remain, '..', $i2+1);
> > +        } while (substr($remain, $i2+2, 1) eq '/');
> > +        $i2 = $l if $i2 == -1;
> 
>   Sorry, this patch causes an endless loop against a line starting with '/'.
> I noticed in my bed. :-)  I should have wrote as below.
> 
> +          } while ($i2 > -1 and substr($remain, $i2+2, 1) eq '/');
>                     ^^^^^^^^^^^^^

Konbanwa Tsuchimura San,

as you wrote in your previous mail,
         $i1 = $l if $i1 == -1;
is much more readable than
         $i1 = ($i1 == -1 ? $l : $i1);
and the former will be used.
Your patch will also be applied (next week, i cannot do it before),
thanks for your help.

Arigato gozaimashita (i am afraid these are the only words i remember
from a 2 months trip in your nice country and a 1 year course long time
ago, and i am even unable to write them with hiragana, so sad).

That said, some people requested support for multi-byte characters; it
would indeed be very nice, and some parts should take advantage of the
Unicode support in Perl 5.6, but i have no skill in this issue and
will not try to implement this support into other parts myself.
Just in case some of you are wondering how they could help with WML ;)
[when replying to this paragraph, please change mail subject]

-- 
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