Bug 153276 - RHEL4: The 'look' command fails to find 'accel'
RHEL4: The 'look' command fails to find 'accel'
Status: CLOSED DUPLICATE of bug 210559
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: util-linux (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Ben Levenson
: 214587 (view as bug list)
Depends On: 210559
  Show dependency treegraph
Reported: 2005-04-04 09:01 EDT by Karel Zak
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-01-11 05:22:03 EST
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 Karel Zak 2005-04-04 09:01:19 EDT
+++ 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

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:

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 14:02:04 EDT

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 Product and Program Management 2006-08-18 13:45:53 EDT
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
Comment 6 Karel Zak 2006-10-12 09:51:16 EDT
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 13:21:08 EST
*** 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.