|
From: SourceForge.net <no...@so...> - 2004-03-01 20:15:28
|
Bugs item #906616, was opened at 2004-02-28 16:34 Message generated for change (Comment added) made by dgp You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=906616&group_id=10894 Category: 42. Regexp Group: current: 8.4.5 Status: Open Resolution: None Priority: 5 Submitted By: Rick Macdonald (rickmacd) >Assigned to: Donal K. Fellows (dkf) Summary: lsearch -regexp error introduced in 8.4.2 Initial Comment: When a list containing an embedded list element starting with a number is used as a regexp in lsearch, a parsing error occurs: couldn't compile regular expression pattern: invalid repetition count(s) If the first element is a text string (eg {zxcv 1234}) the error does not occur. I hit this problem when moving from 8.3.3 to 8.4.5. I tried every 8.4 release (downloaded directly from SF and built fresh) and determined it first broke in 8.4.2. I hope this helps. /usr/local/src/tcltk/tcl8.4.1/unix$ gcc --version gcc (GCC) 3.3.3 20040125 (prerelease) (Debian) The details below apply to tests run on Solaris 5.8 and Linux (Debian sid). Platform/OS does not seem to be an issue. It is the {1234 zxcv} element in the following list that triggers the problem: % list "" 2134 qwer "1234 zxcv" 2345 asdf {} 2134 qwer {1234 zxcv} 2345 asdf In the examples below I'm searching an empty list but this is just to simplify the examples and isn't an issue. /usr/local/src/tcltk/tcl8.4.2/unix$ LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./tclsh % info patchlevel 8.4.2 % lsearch -regexp {} ^[list "" 2134 qwer "1234 zxcv" 2345 asdf] couldn't compile regular expression pattern: invalid repetition count(s) % lsearch -regexp {} ^[list "" 2134 qwer "zxcv 1234" 2345 asdf] -1 % lsearch -regexp {} ^[list "" 2134 qwer "asdf zxcv" 2345 asdf] -1 % exit /usr/local/src/tcltk/tcl8.4.1/unix$ LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./tclsh % info patchlevel 8.4.1 % lsearch -regexp {} ^[list "" 2134 qwer "1234 zxcv" 2345 asdf] -1 % lsearch -regexp {} ^[list "" 2134 qwer "zxcv 1234" 2345 asdf] -1 % lsearch -regexp {} ^[list "" 2134 qwer "asdf zxcv" 2345 asdf] -1 % exit ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2004-03-01 15:10 Message: Logged In: YES user_id=80530 It looks like when [lsearch] was given an empty list, it did not bother to compile the regular expression, because there was no comparing to be done, so invalid regexp's were not reported. It's that slight change in behavior that's causing you trouble? Probably you should correct your code so it does not construct an invalid regexp for passing in. Passing to dkf for another opinion on whether this error behavior is something we needed to preserve. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2004-03-01 15:06 Message: Logged In: YES user_id=80530 hmmm... no. % lsearch -regexp {} {^{} 2134 qwer {1234 zxcv} 2345 asdf} couldn't compile regular expression pattern: invalid repetition count(s) % info patch 8.4.6 % lsearch -regexp {} {^{} 2134 qwer {1234 zxcv} 2345 asdf} -1 % info patch 8.3.5 % regexp {^{} 2134 qwer {1234 zxcv} 2345 asdf} {} couldn't compile regular expression pattern: invalid repetition count(s) ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2004-03-01 14:59 Message: Logged In: YES user_id=80530 so [lsearch] has nothing to do with this right. It's just a question of what strings form a legal regexp ? % regexp "^{} 2134 qwer {1234 zxcv} 2345 asdf" {} couldn't compile regular expression pattern: invalid repetition count(s) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=906616&group_id=10894 |