Bug 437333 - Case insensitive search doesn't work if search term includes upper-case characters
Summary: Case insensitive search doesn't work if search term includes upper-case chara...
Alias: None
Product: Fedora
Classification: Fedora
Component: less
Version: 8
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Zdenek Prikryl
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-03-13 16:14 UTC by Stephen Warren
Modified: 2008-03-13 16:24 UTC (History)
0 users

Clone Of:
Last Closed: 2008-03-13 16:24:43 UTC

Attachments (Terms of Use)

Description Stephen Warren 2008-03-13 16:14:53 UTC
Description of problem:
Case insensitive search doesn't work if search term includes upper-case characters.

Version-Release number of selected component (if applicable):

How reproducible:

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.
Actual results:
Case insensitive search doesn't work if search term entered by user isn't all
lower case.

Expected results:
When in case-insensitive search mode, both the file content and the search term
should be lower-cased prior to comparison.

Additional info:
This was extremely confusing until I worked out what the problem was; it looked
like less's search was completely broken!

Comment 1 Stephen Warren 2008-03-13 16:21:56 UTC
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]
        ^   ^

Comment 2 Stephen Warren 2008-03-13 16:24:43 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.