The "look" cli dictionary only sees capitalized words

Bug #1971425 reported by Lars Ekman
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
util-linux (Debian)
Confirmed
Unknown
util-linux (Ubuntu)
Triaged
Medium
Unassigned
Jammy
Triaged
Medium
Unassigned
Lunar
Won't Fix
Medium
Unassigned

Bug Description

In Ubuntu 20.04;
~ > look accident
accident
accident's
accidental
accidental's
accidentally
accidentals
accidents
In Ubuntu 22.04;
~ > look accident
(nothing)
~ > look acc
Accenture
Accenture's
Accra
Accra's
Digging deeper; the dictionary at /usr/share/dict/words seems OK.
If I copy the "look" binary from Ubuntu 20.04 and use it on Ubuntu 22.04 it works;
~ > ./look accident
accident
accidental
accidentally
accidental's
accidentals
accident's
accidents

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: bsdextrautils 2.37.2-4ubuntu3
ProcVersionSignature: Ubuntu 5.15.0-27.28-generic 5.15.30
Uname: Linux 5.15.0-27-generic x86_64
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: XFCE
Date: Tue May 3 14:19:57 2022
InstallationDate: Installed on 2018-09-07 (1334 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: util-linux
UpgradeStatus: Upgraded to jammy on 2022-05-01 (2 days ago)

Revision history for this message
Lars Ekman (uablrek) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report. Indeed it seems buggy but the description isn't accurate since using it with 'keyboard' works as expected

Changed in util-linux (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Sebastien Bacher (seb128) wrote :
Revision history for this message
Brian Murray (brian-murray) wrote :

Curiously some words starting with b seem fine:

 $ look butter
butter
buttercup
buttercup's
buttercups
buttered
butterfat
..

tags: added: rls-jj-incoming
tags: removed: rls-jj-incoming
Revision history for this message
Olivier Gayot (ogayot) wrote (last edit ):

There seems to be something wrong with the way the ignore-case option is handled:

   -f, --ignore-case fold lower case to upper case characters

The option is enabled by default when running `look <word>` and the only way to disable it is to specify the wordlist as the next positional parameter.

```
$ look accident
> KO (-f is enabled by default)
$ look accident /usr/share/dict/words
accident
accidental
accidentally
accidental's
accidentals
accident's
accidents
> OK (-f is not enabled)
$ look -f accident /usr/share/dict/words
> KO
```

Also, look was provided by bsdmainutils (i.e., src:bsdmainutils) in focal but bsdextrautils (i.e., src:util-linux) in impish/jammy. This is a different implemention. I wonder if the assumption on the sorting order of the dictionary is the same.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The same behavior can be seen in Ubuntu 23.04.

The look command requires a sorted file.
If no argument is given /usr/share/dict/words is used as default file and the f flag is set.
/usr/share/dict/words is sorted with upper case preceding lower case.
But when the f flag is set a sort ignoring case is assumed.

So the command look works as documented.

It is simply that the sort sequence of /usr/share/dict/words does not match what look needs.

You can create your own wordlist, sort it to your needs, and point environment variable WORDLIST to it.

$ cat /usr/share/dict/american-english | sort > foo
$ WORDLIST=foo look accicent
accident
accidental
accidentally
accidental's
accidentals
accident's
accidents

I would suggest not to change anything in util-linux.

Revision history for this message
Lars Ekman (uablrek) wrote :

The --dictionary-order option must be given to "sort" as described in;

https://github.com/util-linux/util-linux/issues/1493#issuecomment-1139358186

Um, will you *ever* fix this?

I am using the work-around with $WORDLIST, and it works fine, but IMO I shouldn't have to.

tags: added: rls-jj-incoming
Changed in util-linux (Ubuntu):
importance: Low → Medium
tags: added: regression-release
Dave Jones (waveform)
tags: added: foundations-todo
removed: regression-release rls-jj-incoming
Changed in util-linux (Ubuntu):
status: Confirmed → Triaged
Changed in util-linux (Ubuntu Jammy):
status: New → Triaged
Changed in util-linux (Ubuntu Lunar):
status: New → Triaged
Changed in util-linux (Ubuntu Jammy):
importance: Undecided → Medium
Changed in util-linux (Ubuntu Lunar):
importance: Undecided → Medium
Changed in util-linux (Debian):
status: Unknown → Confirmed
Revision history for this message
Brian Murray (brian-murray) wrote :

Ubuntu 23.04 (Lunar Lobster) has reached end of life, so this bug will not be fixed for that specific release.

Changed in util-linux (Ubuntu Lunar):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.