On Sat, Mar 19, 2005 at 09:38:14PM +0100, Marc Haber wrote:

||  tags #280178 patch moreinfo
||  thanks
||
||  On Sun, Nov 07, 2004 at 09:38:29PM +0100, Vincent Zweije wrote:
||  > There are bugs in how ippl reads its configuration file, which may cause
||  > valid configurations to be rejected or interpreted incorrectly.
||
||  Can you please give examples which can be used to do pre/post tests of
||  your patch?

It's a long time ago.

I'll go through the patch and annotate it, in the hope that you can
figure out some test cases.

General note: I've added () for old lex compatibility.

If you need working test cases, I'll need more time.

||  > A patch is attached which thoroughly cleans up the tokeniser
||  > specification.
||
||  I intend to apply that patch and upload to experimental after I have
||  received test cases.

||  diff -ru ippl-1.4.14-3/Source/ippl.l ippl-1.4.14-3.1/Source/ippl.l
||  --- ippl-1.4.14-3/Source/ippl.l     2004-11-07 20:56:41.000000000 +0100
||  +++ ippl-1.4.14-3.1/Source/ippl.l   2004-10-23 18:49:22.000000000 +0200
||  @@ -33,39 +33,35 @@
||
||   %}
||
||  -white     [ \t]+
||  +cr        [\r]
||  +lf        [\n]
||  +white     [ \a\b\t\v\f]+
||  +digit     [0-9]
||  +letter    [A-Za-z]
||  +alpha     [A-Za-z0-9]
||  +hyp       [-_]
||  +filechar  [-_A-Za-z0-9.\\]
||  +labelchar [-_A-Za-z0-9]

The following characters are now also accepted as white space:
    \a - ascii  7 - audible bell
    \b - ascii  8 - backspace
    \t - ascii  9 - tab
    \v - ascii 11 - vertical tab
    \f - ascii 12 - form feed
Pre-patch should report an unexpected character on each of these in the
config file.

||  -octdigit  [0-7]
||  -hexdigit  [0-9A-Fa-f]
||  -decdigit  [0-9]
||  +eol       ({cr}|{lf}|{cr}{lf}|{lf}{cr})

eol:
The following character sequence are now interpreted as end-of-line:
    \n   - ascii 10    - line feed                      (already pre-patch)
    \r   - ascii 13    - carriage return                (new)
    \n\r - ascii 10,13 - line feed, carriage return     (new)
    \r\n - ascii 13,10 - carriage return, line feed     (new)
Pre-patch should complain about \r being unexpected.

||  -octchar   {octdigit}+
||  -hexchar   {hexdigit}+
||  -decchar   {decdigit}+
||  +integer   ({digit}+)
||
||  -char      {octchar}|{hexchar}|{decchar}
||  -integer   {decdigit}+

integer:
No change.

||  +byte      (0*(1[0-9][0-9]|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))
||  +ip        ({byte}\.{byte}\.{byte}\.{byte})
||
||  -ip        {char}"."{char}"."{char}"."{char}

ip:
Hexadecimal digits are no longer accepted in IP address tokens.
IP address tokens are limited to byte-range values (0-255):
byte-overflow is no longer possible when decoding.

Try a config pattern such as:

    1.2.3.256 (possibly accepted as 1.2.3.0 pre-patch)
    a.b.c.de (pre-patch accepted as IP address, but still looked up by
        forgiving address decoding function. Handled properly as
        hostmask post-patch)
    a.b.c.de/32 (pre-patch accepted, post-patch rejected)

||  +labelmask ({labelchar}+|"*")
||  +hostmask  ({labelmask}("."{labelmask})*"."?)
||
||  -letter    [A-Za-z]
||  -digit     [0-9]
||  -letdig    {letter}|{digit}
||  -hyp       "-"|"_"
||  -letdighyp {letdig}|{hyp}
||  -label     {letdig}+({hyp}{letdig}+)*
||  +ident     ({letter}{alpha}*(-{alpha}+)*)
||
||  -hostmask  ({label}|"*")("."({label}|"*"))*"."?

hostmask:
Factorized labelmask. No effective change.

||  -ident     {letter}("-"?{letdig}+)*

ident:
Disambiguated. No effective change.

||  -letfile   {letdighyp}|"\\"|"."
||  -file      ("/"{letfile}+)("/"{letfile}+)+
||  +file      (("/"{filechar}+)("/"{filechar}+)+)

file:
Sanely renamed letfile->filechar. No effective change.

||   %%
||
||   {white}               { /* Ignore */ }
||  -"#".*$                { /* Ignore */ }
||  -"\n"                  { line_number++; return EOL; }
||  +#.*                   { /* Ignore */ }
||  +{eol}                 { line_number++; return EOL; }

comment:
Removed unnecessary "".
Removed unnecessary $ anchor.
No effective change.

eol:
As said, accepts extra sequences. However, a cr in or after a comment will
be gobbled by the comment token. This was already the case pre-patch,
and is harmless unless lines are ended by lone cr characters (as in
macintosh style line endings).

||   [lL][oO][gG][fF][oO][rR][mM][aA][tT] return LOGFORMAT;
||   [dD][eE][tT][aA][iI][lL][eE][dD] return DETAILED;
||  @@ -132,14 +128,14 @@
||   "addr_mask_req"       { yylval.longval = 17; return NUMBER; }
||   "addr_mask_reply"     { yylval.longval = 18; return NUMBER; }
||
||  -{ip}                  {
||  +{ident}               {
||                           yylval.stringval = strdup(yytext);
||  -                        return IP;
||  +                        return IDENTIFIER;
||                         }
||
||  -{ident}               {
||  +{ip}                  {
||                           yylval.stringval = strdup(yytext);
||  -                        return IDENTIFIER;
||  +                        return IP;
||                         }
||
||   {hostmask}            {

I appear to have swapped the order of {ip} and {ident} to give {ident}
priority over {ip}, but in rear view I think this is not necessary because
they never recognize the same character sequences; {ip} always contains
3 dots, {ident} always contains 0 dots.

So much for now.                                                  Vincent.
-- 
Vincent Zweije <[EMAIL PROTECTED]>    | "If you're flamed in a group you
<http://www.xs4all.nl/~zweije/>      | don't read, does anybody get burnt?"
[Xhost should be taken out and shot] |            -- Paul Tomblin on a.s.r.

Attachment: signature.asc
Description: Digital signature

Reply via email to