Red Hat Bugzilla – Bug 437333
Case insensitive search doesn't work if search term includes upper-case characters
Last modified: 2008-03-13 12:24:43 EDT
Description of problem:
Case insensitive search doesn't work if search term includes upper-case characters.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. $ less somefile
2. Assume the file actually contains "int someLongVarName;"
3. /someLongVarName<ENTER> [i.e. search with correct case]
4. Note that the text is found in the file
5. -i [i.e. switch to case-insensitive search]
6. /someLongVarName<ENTER> [i.e. search with correct case]
7. Note that the string could not be found!
8. /somelongvarname<ENTER> [i.e. search with correct case]
9. Note that the string is again found if the search term is entered lower case.
Case insensitive search doesn't work if search term entered by user isn't all
When in case-insensitive search mode, both the file content and the search term
should be lower-cased prior to comparison.
This was extremely confusing until I worked out what the problem was; it looked
like less's search was completely broken!
I need to modify the repro steps a little.
In step 6, if you search for the exact correct mixed-case string, it still works
in "ignore case" mode.
However, if you search for something that's still mixed-case, but with a
different case mix than the file text it fails.
So, step 6 should be:
6. /somelongvarName<ENTER> [i.e. search with mismatching case]
Sigh. And now I worked that out, it seems that what I want is "-I" mode, not
"-i" mode; it's behaving as documented. I'm never going to remember that...
So, closing the bug.