Re: Bug in crm114 parser? Or is it me again?

Bill Yerazunis <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>

   From: "Ger Hobbelt" <[email protected]>


   Bill,

   Here's the code as is:

Doesn't run for me.

Something is seriously wrong; I get:

 # crm ger.crm 

 crm: *WARNING* 
   This operand doesn't seem to end.  Bug?  
  -->   

 I'll try to keep working.
 This happened at line 9 of file ger.crm
 (runtime system location: crm_stmt_parser.c(516) in routine: crm_generic_parse_line)
 The line was: 
 --> match [:spam:] (:: :spamdir: :spamwildcard:) /^(.*[\\\/])([^\\\/]*)/
 <-- 

 crm: *ERROR* 
  Regular Expression Compilation Problem: Missing ']'
  Sorry, but this program is very sick and probably should be killed off.
 This happened at line 9 of file ger.crm
 (runtime system location: crm_expr_match.c(247) in routine: crm_expr_match)
 The line was: 
 --> match [:spam:] (:: :spamdir: :spamwildcard:) /^(.*[\\\/])([^\\\/]*)/
 <--

which looks like it means that it wasn't happy with all the backslashes
in your regex.

However, that's not the problem you're asking about.  

If I re-edit the regex to lessen the confusion (there is perhaps
some nastyness in the code that does backslash expansion) 
from:

  match [:spam:] (:: :spamdir: :spamwildcard:) /^(.*[\\\/])([^\\\/]*)/

to:

  match [:spam:] (:: :spamdir: :spamwildcard:) /^(.*[\/\\])([^\/\\]*)/

which _should_ be identical in behavior, but they aren't, because
the first one gets an error and the second one works, yielding:

  # crm ger.crm 
  spam source: /dir1/dir2/dir3/ --  -- /dir1/dir2/dir3/
  OK 1
  spam source: /dir1/dir2/dir3/* -- * -- /dir1/dir2/dir3/*
  OK 2
  #

which is very counterintuitive, and almost *certainly* means we've
got a subtle bug in backslash expansion.

     - Bill Yerazunis

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.