Bug: The "casesensitive" flag is handled inconsistently in search
Please see the test cases below. When the
casesensitive flag is selected, the behavior differs between topic and text scope:
- With scope=topic, if casesensitive is among the options, search is casesensitive (whether set to on or off), but regex is never used;
- with scope=text, if regex is among the options, search is regular expression (whether set to on or off), and casesensitivity is determined based on the regular expression setting.
Test case

Test cases commented out due to performance problems on twiki.org
-
casesensitive="on", regex="on"
%SEARCH{ "location" casesensitive="on" regex="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
casesensitive="on", regex="off"
%SEARCH{ "location" casesensitive="on" regex="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" casesensitive="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
casesensitive="off", regex="on"
%SEARCH{ "location" casesensitive="off" regex="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
casesensitive="off", regex="off"
%SEARCH{ "location" casesensitive="off" regex="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" casesensitive="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" regex="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" regex="off" nosearch="off" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", casesensitive="on", regex="on"
%SEARCH{ "location" scope="topic" casesensitive="on" regex="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", casesensitive="on", regex="off"
%SEARCH{ "location" scope="topic" casesensitive="on" regex="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", casesensitive="on"
%SEARCH{ "location" scope="topic" casesensitive="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", casesensitive="off", regex="on"
%SEARCH{ "location" scope="topic" casesensitive="off" regex="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", casesensitive="off", regex="off"
%SEARCH{ "location" scope="topic" casesensitive="off" regex="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", casesensitive="off", regex="on"
%SEARCH{ "location" scope="topic" casesensitive="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" scope="topic" regex="off" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
-
scope="text", regex="off"
%SEARCH{ "location" scope="topic" regex="on" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
%SEARCH{ "location" scope="topic" nosearch="on" nototal="on" web="Main" format=" * $web.$topic" }%
Observed result
| scope |
case |
regex |
cmd |
args |
result |
| text |
on |
on |
egrep |
-i -l -H |
wrong |
| text |
on |
off |
egrep |
-i -l -H |
wrong |
| text |
on |
|
fgrep |
-l -H |
correct |
| text |
off |
on |
egrep |
-i -l -H |
wrong |
| text |
off |
off |
egrep |
-i -l -H |
wrong |
| text |
off |
|
fgrep |
-l -H |
wrong |
| text |
|
on |
egrep |
-l -H |
wrong |
| text |
|
off |
egrep |
-l -H |
wrong |
| text |
|
|
egrep |
-l -H |
wrong |
| topic |
on |
on |
grep |
|
wrong |
| topic |
on |
off |
grep |
|
wrong |
| topic |
on |
|
grep |
|
wrong |
| topic |
off |
on |
grep |
|
wrong |
| topic |
off |
off |
grep |
|
wrong |
| topic |
off |
|
grep |
|
wrong |
| topic |
|
on |
grep |
/i |
correct |
| topic |
|
off |
grep |
/i |
correct |
| topic |
|
|
grep |
/i |
correct |
Environment
--
ThomasWeigert - 31 May 2005
Follow up
Fix record
The
-i option for egrep in
lib/TWiki.cfg appears to be backwards. When switching these around, the search behaves as expected (at least for case sensitive).
Fix in
SVN 4346.
Discussion
This seems to be a fixed bug. I'm marking it
MergedToCore
--
TWikiJanitor - 10 Sep 2008