Red Hat Bugzilla – Bug 153276
RHEL4: The 'look' command fails to find 'accel'
Last modified: 2007-11-30 17:07:17 EST
+++ 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)
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
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):
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
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.
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
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)
*** Bug 214587 has been marked as a duplicate of this bug. ***