[CentOS] broken behavior with `look`

Wed Jul 19 14:08:04 UTC 2006
Dag Wieers <dag at wieers.com>

On Tue, 18 Jul 2006, Rodrigo Barbosa wrote:

> On Tue, Jul 18, 2006 at 07:11:25PM -0400, Mike Hunter wrote:
> > Hey everybody,
> > 
> > I'm having a strange problem with a hosted CentOS environment.  I like
> > to use `look` to correct my spelling.  But it isn't willing to help me
> > with the word "manager":
> > 
> > #>look man | wc -l                                                     
> > 1001
> > #>look mana | wc -l                                      
> > 0
> > #>grep "^mana" /usr/share/dict/words  | wc -l                           
> > 54
> 
> #> look man | grep -B2 -A2 manager
> managemental
> managements
> manager
> manager's
> managerdom
> manageress
> managerial
> managerially
> managers
> managership
> managery
> manages
> managing
> 
> > #>md5sum `which look`
> > 05ef59ae2f9183e525ec531dcb07ee8b  /usr/bin/look
> > #>cat /etc/redhat-release 
> > CentOS release 4.3 (Final)
> > #>uname -a
> > Linux blahblah.com 2.6.8-022stab078.9-entnosplit #1 SMP Thu Jun 8 12:46:44 MSD 2006 i686 athlon i386 GNU/Linux
> 
> Virtuozzo VPS ?
> 
> > Can anybody confirm these results?  Any suggestions for a fix?
> 
> I can.
> 
> util-linux-2.12a-16.EL4.16
> 
> Some other interesting (d)effects:
> 
> #> look AngloCatholicism
> Anglo-Catholicism
> 
> (Note: Both Anglo-Catholicism and AngloCatholicism are on the words file)
> 
> And now, for something entirely new:
> 
> #> look manager /usr/share/dict/words 
> manager
> manager's
> managerdom
> manageress
> managerial
> managerially
> managers
> managership
> managery
> 
> Which leads me to the conclusion that is has nothing to do with the words
> file, and it a but of the look utility itself.
> 
> Running strace, you can see that, in both cases, the exact same file is
> opened:
> 
> #> strace look manager /usr/share/dict/words
> (...)
> open("/usr/share/dict/words", O_RDONLY|O_LARGEFILE) = 3
> (...)
> 
> #> strace look manager
> (...)
> open("/usr/share/dict/words", O_RDONLY|O_LARGEFILE) = 3
> (...)
> 
> Go figure.

Check this:

diff -u <(ltrace -S look mana 2>&1) <(ltrace -S look mana /usr/share/dict/words 2>&1)

Definitely something wrong with the internal logic :)

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]