Bug 437333 - Case insensitive search doesn't work if search term includes upper-case characters
Case insensitive search doesn't work if search term includes upper-case chara...
Product: Fedora
Classification: Fedora
Component: less (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Zdenek Prikryl
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-03-13 12:14 EDT by Stephen Warren
Modified: 2008-03-13 12:24 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-03-13 12:24:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Stephen Warren 2008-03-13 12:14:53 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):

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 12:21:56 EDT
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 12:24:43 EDT
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.