Bug 153276 - RHEL4: The 'look' command fails to find 'accel'
Summary: RHEL4: The 'look' command fails to find 'accel'
Keywords:
Status: CLOSED DUPLICATE of bug 210559
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: util-linux
Version: 4.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Karel Zak
QA Contact: Ben Levenson
URL:
Whiteboard:
: 214587 (view as bug list)
Depends On: 210559
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-04 13:01 UTC by Karel Zak
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-01-11 10:22:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Karel Zak 2005-04-04 13:01:19 UTC
+++ This bug was initially created as a clone of Bug #147949 +++

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
I wanted to find out how to spell accelerate.  So, I typed 'look
accel' and got no answers.  I then looked for 'acce', 'acc', 'ac', and
'a'.  Only 'a' returned any answers, and it returned a list of all
words starting with a capital A only.

I tried this on a RedHat AS-3 system, and it worked as expected.

I downloaded the srpm for util-linux-2.12a-19, and added some
debugging statements to look.c, lines 341 and 386, to print what the
strncasecmp and strncmp were seeing and reporting.

It appears the problem is that strncasecmp is expecting the
/usr/share/dict/words file to be sorted ignoring case, while the
strncmp is expecting the file to not be sorted ignoring case.  As the
file is sorted not ignoring case, strncasecmp is going to lose every time.

As a test, I typed 'look accel /usr/share/dict/words', and it worked
perfectly.  This is the only way I could see to turn off
case-insensitivity.

The solution is going to be complicated.  
Step 1: sort /usr/share/dict/words while ignoring case.  
Step 2: use strncasecmp to find the words.  
Step 3: if the user wants case sensitivity, filter out words that fail
strncmp when printing the results.

Oh, and add a command line option that lets you turn off case
insensitivity, which defaults to on (-f).

Version-Release number of selected component (if applicable):
util-linux-2.12a-19, util-linux-2.12a-16

How reproducible:
Always

Steps to Reproduce:
1. Type: look accel
2. Type: look accel /usr/share/dict/words
3. Type: look a
    

Actual Results:  'look accel' returns nothing.
'look accel /usr/share/dict/words' returns the correct results.
'look a' returns only words starting with 'A'.

Expected Results:  'look accel' should have reported words starting
with 'accel', upper or lower case.
'look a' should have reported all words starting with 'a', upper or
lower case.

Comment 3 Shing-Shong Shei 2006-08-01 18:02:04 UTC
Hi,

I am really surprised that this bug was created in 2005-04-04 and
it has be more than a year and it has not been fixed yet!

It's more generic than that -- try 'look a' and it shows NO word
at all and this is unique to RHEL derived system.  I have traced
the culprit to be the file util-linux-2.12p-look-separator.patch.
If you comment out applying this patch in spec file and build the
package, then the generated 'look' works as expected.  This is in
RHEL4 U3.  (But I tried the 2.13-0.20.4 in Fedora Core 5 and it
failed there too.)  Hope this helps.

Bruce Shei

Comment 4 RHEL Program Management 2006-08-18 17:45:53 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 6 Karel Zak 2006-10-12 13:51:16 UTC
The look command is broken and fix requires update the words package too. It
works as expected in FC5, and RHEL5. (so comment #3 about FC is not true from my
point of view)

Comment 7 Karel Zak 2006-12-02 18:21:08 UTC
*** Bug 214587 has been marked as a duplicate of this bug. ***


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