Package: man-db
Version: 2.13.1-1
Severity: normal
Tags: upstream
X-Debbugs-Cc: [email protected]

Dear Maintainer,

man-db uses the `LANGUAGE` environment variable in addition to the
locale to determine the man page search path. However, unlike gettext
(which is probably the authoritative documentation for the `LANGUAGE`
variable), it does not treat that variable as a search order / list of
priorities and simply sorts candidates lexically instead.

For example, if `LANGUAGE` is set to `fr:de`, it will show the German
man page instead of the French one (assuming both exist):

```
# Expected result: /usr/share/man/fr/man1/dpkg-architecture.1.gz
$ env -i LC_MESSAGES=en_US LANGUAGE=fr:de man -w dpkg-architecture
/usr/share/man/de/man1/dpkg-architecture.1.gz

# Matches expectations
$ env -i LC_MESSAGES=en_US LANGUAGE=fr man -w dpkg-architecture
/usr/share/man/fr/man1/dpkg-architecture.1.gz
```

Similarly, it seems to prefer the man pages matching `LC_MESSAGES`
(including from the non-locale directories when using an `en_*`
locale) even if it's not the first language in `LANGUAGE` (may be an
unusual combination but should still work):

```
# Expected result: /usr/share/man/fr/man1/dpkg-architecture.1.gz
$ env -i LC_MESSAGES=nl_NL LANGUAGE=fr:nl man -w dpkg-architecture
/usr/share/man/nl/man1/dpkg-architecture.1.gz

# Expected result: /usr/share/man/fr/man1/dpkg-architecture.1.gz
$ env -i LC_MESSAGES=nl_NL LANGUAGE=fr man -w dpkg-architecture
/usr/share/man/nl/man1/dpkg-architecture.1.gz

# Expected result: /usr/share/man/nl/man1/dpkg-architecture.1.gz
$ env -i LC_MESSAGES=fr_FR LANGUAGE=nl:fr man -w dpkg-architecture
/usr/share/man/fr/man1/dpkg-architecture.1.gz

# Expected result: /usr/share/man/nl/man1/dpkg-architecture.1.gz
$ env -i LC_MESSAGES=en_US LANGUAGE=nl:en man -w dpkg-architecture
/usr/share/man/man1/dpkg-architecture.1.gz
```


Not sure if this used to work (several Debian versions ago 😅) or if
it just got more noticeable over time because more man pages have
translations (installed by default) now.

I've left out the `--debug` versions of the above invocations as
they're rather verbose and are easy enough to reproduce on pretty much
any Debian system that has the `dpkg-dev` package installed.


Sascha

-- System Information:
Debian Release: 13.4
  APT prefers stable-updates
  APT policy: (990, 'stable-updates'), (990, 'stable-security'), (990, 
'stable'), (500, 'stable-security-debug'), (500, 'stable-debug'), (100, 
'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: armel, armhf, i386

Kernel: Linux 6.12.73+deb13-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_GB, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en:en_US:C:de_DE:de
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages man-db depends on:
ii  bsdextrautils          2.41-5
ii  bsdmainutils           12.1.8
ii  debconf [debconf-2.0]  1.5.91
ii  groff-base             1.23.0-9
ii  libc6                  2.41-12+deb13u2
ii  libgdbm6t64            1.24-2
ii  libpipeline1           1.5.8-1
ii  libseccomp2            2.6.0-2
ii  zlib1g                 1:1.3.dfsg+really1.3.1-1+b1

man-db recommends no packages.

Versions of packages man-db suggests:
ii  apparmor                   4.1.0-1
ii  chromium [www-browser]     147.0.7727.137-1~deb13u1
ii  firefox-esr [www-browser]  140.10.1esr-1~deb13u1
pn  groff                      <none>
ii  less                       668-1
ii  w3m [www-browser]          0.5.3+git20230121-2.1

-- debconf information excluded

Reply via email to