Subject: bug#38838: 'whatis' doesn't work

From: zimoun <[email-masked]>
Date: Mon, 6 Jan 2020 19:05:06 +0100

Dear,

I confirm that something appears unexpected with the command 'whatis'.

Below, using Guix 3a695c01d7ee18f30f22df53f3c44dfac04017f1, and running
`guix environment --ad-hoc man-db man-pages --pure` then let output the
internal debugging information (option '-d'). See below.

Everything seems pointing to the correct path, so maybe it should come
from the 'index.db' file.

Well, let manually build an index, by first download the necessary files
with (outside the environment):

   guix build man-pages --no-grafts --check -K

then inside the environment:

  mandb -c /tmp/guix-build-man-pages-5.04.drv-0/man-pages-5.04

and now,

  whatis -M /tmp/guix-build-man-pages-5.04.drv-0/man-pages-5.04 memcpy

works as expected.

Last, note that using the 'apropos/whatis' binary from Debian and the
path of the temporary profile (guix environment), I get:

--8<---------------cut here---------------start------------->8---
/usr/bin/apropos -M
/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man memcpy
memcpy (3)           - copy memory area
wmemcpy (3)          - copy an array of wide-characters

/usr/bin/whatis -M
/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man memcpy
memcpy: nothing appropriate
--8<---------------cut here---------------end--------------->8---

I do not know if this report helps and if the index is the culprit.
What do you think?

All the best,
simon

--8<---------------cut here---------------start------------->8---
# whatis
man -d -f memcpy
>From the config file
/gnu/store/l9j6dsfs2i4spfkia492wnighplvhb1c-man-db-2.9.0/etc/man_db.conf:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Added sections: `1', `n', `l', `8', `3', `0', `2', `5', `4', `9', `6', `7'.
>From the config file
/gnu/store/l9j6dsfs2i4spfkia492wnighplvhb1c-man-db-2.9.0/etc/man_db.conf:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Added sections: `1', `n', `l', `8', `3', `0', `2', `5', `4', `9', `6', `7'.
add_nls_manpaths(): processing
/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
checking for locale C
adding /gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
to manpathlist
final search path =
/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
path=/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
memcpy: nothing appropriate.
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
# apropos
man -d -k memcpy
>From the config file
/gnu/store/l9j6dsfs2i4spfkia492wnighplvhb1c-man-db-2.9.0/etc/man_db.conf:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Added sections: `1', `n', `l', `8', `3', `0', `2', `5', `4', `9', `6', `7'.
>From the config file
/gnu/store/l9j6dsfs2i4spfkia492wnighplvhb1c-man-db-2.9.0/etc/man_db.conf:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Added sections: `1', `n', `l', `8', `3', `0', `2', `5', `4', `9', `6', `7'.
add_nls_manpaths(): processing
/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
checking for locale C
adding /gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
to manpathlist
final search path =
/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
path=/gnu/store/hg02c2i5ycd4g0498xwgsbxyikz1bvf1-profile/share/man
name:      memcpy
sec. ext:  3
section:   3
comp. ext: gz
id:        A
mtime:     0.000000000
pointer:   -
filter:    -
whatis:    copy memory area

memcpy (3)           - copy memory area
name:      wmemcpy
sec. ext:  3
section:   3
comp. ext: gz
id:        A
mtime:     0.000000000
pointer:   -
filter:    -
whatis:    copy an array of wide-characters

wmemcpy (3)          - copy an array of wide-characters
--8<---------------cut here---------------end--------------->8---