Bug#973471: look has unpredictable behavior

2022-05-25 Thread chris
Currently `look` is broken, according to upstream and Ubuntu bugs:
https://github.com/util-linux/util-linux/issues/1493[1]
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1971425[2]

aptitude show wamerican bsdextrautils  

Package: wamerican
Version: 2020.12.07-2 
State: installed 
...
This package provides the file /usr/share/dict/american-english containing a 
list of English 
words with American spellings. This list can be used by spelling checkers, and 
by programs 
such as look(1).
 
Package: bsdextrautils 
Version: 2.38-4 
New: yes 
State: installed 
Automatically installed: yes 
...

`bsdextrautils` cannot be not installed because it's in the dependencies of 
`man-db`.

Thanks,
Chris






[1] https://github.com/util-linux/util-linux/issues/1493
[2] https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1971425


Bug#973471: look has unpredictable behavior

2022-04-20 Thread Yair Yarom
Package: util-linux
Version: 2.36.1-8+deb11u1
Followup-For: Bug #973471

Hello,

The issue is that currently "look" is broken on debian/bullseye. I don't know
whether this package needs to be updated or the dictionary package(s).

Attached is a patch that removes the default -d and -f when no dictionary file
is given, which seems to mitigate this issue.

Regards,
Yair.

-- System Information:
Debian Release: 11.3
  APT prefers stable
  APT policy: (990, 'stable'), (910, 'stable-security')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.104-aufs-3 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_IL.UTF-8, LC_CTYPE=en_IL.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en_GB:en
Shell: /bin/sh linked to /usr/bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages util-linux depends on:
ii  libaudit1  1:3.0-2
ii  libblkid1  2.36.1-8+deb11u1
ii  libc6  2.31-13+deb11u3
ii  libcap-ng0 0.7.9-2.2+b1
ii  libcrypt1  1:4.4.18-4
ii  libmount1  2.36.1-8+deb11u1
ii  libpam0g   1.4.0-9+deb11u1
ii  libselinux13.1-3
ii  libsmartcols1  2.36.1-8+deb11u1
ii  libsystemd0247.3-7
ii  libtinfo6  6.2+20201114-2
ii  libudev1   247.3-7
ii  libuuid1   2.36.1-8+deb11u1
ii  login  1:4.8.1-1
ii  zlib1g 1:1.2.11.dfsg-2

util-linux recommends no packages.

Versions of packages util-linux suggests:
ii  dosfstools  4.2-1
ii  kbd 2.3.0-3
pn  util-linux-locales  

-- Configuration Files:
/etc/pam.d/runuser [Errno 2] No such file or directory: '/etc/pam.d/runuser'
/etc/pam.d/runuser-l [Errno 2] No such file or directory: '/etc/pam.d/runuser-l'
/etc/pam.d/su changed [not included]
/etc/pam.d/su-l changed [not included]

-- no debconf information
--- a/misc-utils/look.1
+++ b/misc-utils/look.1
@@ -69,15 +69,13 @@
 .TP
 .BR \-d , " \-\-alphanum"
 Use normal dictionary character set and order, i.e., only blanks and
-alphanumeric characters are compared.  This is on by default if no file is
-specified.
+alphanumeric characters are compared.
 
 Note that blanks have been added to dictionary character set for
 compatibility with \fBsort \-d\fR command since version 2.28.
 .TP
 .BR \-f , " \-\-ignore\-case"
-Ignore the case of alphabetic characters.  This is on by default if no file is
-specified.
+Ignore the case of alphabetic characters.
 .TP
 .BR \-t , " \-\-terminate " \fIcharacter\fR
 Specify a string termination character, i.e., only the characters
--- a/misc-utils/look.c
+++ b/misc-utils/look.c
@@ -141,8 +141,8 @@
string = *argv++;
file = *argv;
break;
-   case 1: /* But set -df by default. */
-   dflag = fflag = 1;
+   case 1: /* But set -df by default (except on 
debian) */
+   //dflag = fflag = 1;
string = *argv;
break;
default:


Bug#973471: look has unpredictable behavior

2020-11-08 Thread Chris Hofstaedtler
Hello Jamie Heilman,

* Jamie Heilman  [201031 09:33]:
> look's behavior became really unpredictable when it migrated from
> bsdmainutils to util-linux.

Thank you for your report.

> $ look achi
[6 results]
> $ grep -ci ^achi /usr/share/dict/words
> 36

For one, you seem to be using a different words file than me:
$ grep -ci '^achi' /usr/share/dict/words
16

Anyway, util-linux's look uses a binary search and has requirements
on the input file. This is documented in the manpage look(1):

| As look performs a binary search, the lines in file must be
| sorted (where sort(1) was given the same options -d and/or -f
| that look is invoked with)

/usr/share/dict/words (in my case /usr/share/dict/american-english)
does not follow these requirements.

If you read the old look(1) manpage, it says under COMPATIBILITY:
| look uses a linear search by default instead of a binary search,
| which is what most other implementations use by default.

Now we are back at "what most other implementations use", so one
less compatibility issue.

If you would like to see improvements over this, please talk to
upstream about it.  Their contacts are:
  E-MAIL: util-li...@vger.kernel.org
  Web:https://github.com/karelzak/util-linux/issues


Best wishes,
Chris



Bug#973471: look has unpredictable behavior

2020-10-31 Thread Jamie Heilman
Package: bsdextrautils
Version: 2.36-3+b1

look's behavior became really unpredictable when it migrated from
bsdmainutils to util-linux.

$ look achi
Achille
Achille's
Achillean
Achilles
Achilles's
Achitophel
$ grep -ci ^achi /usr/share/dict/words
36
$

This is just one example but sometimes it works and sometimes it
doesn't.  It tends to behave consistently for a given prefix, but if
it chooses capitalized words or not varies (locale makes no difference
that I can see).  eg:

$ look cra | wc -l
518
$ grep -ci ^cra /usr/share/dict/words 
609
$ diff -u <(grep -i ^cra /usr/share/dict/words) <(look cra) | head
--- /dev/fd/63  2020-10-31 08:00:51.587099984 +
+++ /dev/fd/62  2020-10-31 08:00:51.587099984 +
@@ -1,94 +1,3 @@
-Crabbe
-Crabbe's
-Craborchard
-Craborchard's
-Crabtree
-Crabtree's
-Cracker

-- 
Jamie Heilman http://audible.transient.net/~jamie/