Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37778 - man looks for localized message catalogs by looking for LC_ALL, LC_MESSAGES and LANG in the wrong(?) order.
Summary: man looks for localized message catalogs by looking for LC_ALL, LC_MESSAGES a...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-10 03:38 UTC by Magnus Lind
Modified: 2004-10-03 00:56 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch that fixes the catget problem (see comments) (man-1.5m-catgets.patch,454 bytes, patch)
2004-08-14 03:49 UTC, Antti Mäkelä
Details | Diff
Ebuild that uses the catgets patch (man-1.5m-r2.ebuild,3.58 KB, text/plain)
2004-08-14 03:49 UTC, Antti Mäkelä
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Lind 2004-01-10 03:38:50 UTC
If there is no message catalog for a given locale, for instance sv_SE, man will show an annoying message like this:

  Failed to open the message catalog "man" for locale "sv_SE"
  (NLSPATH="/usr/share/locale/%L/%N")

Contrary to what the man manpage seems to indicate, I can't avoid this message by having man search for english messages by setting LC_MESSAGES to an English locale.

According to the man manpage LC_MESSAGES can be used to set the locale to use for messages. If not LC_MESSAGES is set, then man will look for the value of LANG instead. But currently man operates in the opposite way, looking for LANG first and then LC_MESSAGES (or LC_ALL, which should override all other LC_* variables).


Reproducible: Always
Steps to Reproduce:
set LANG to "sv_SE"
set LC_MESSAGES (or LC_ALL) to "en_US" (or any other locale - has no effect)
try to use a man page that doesn't exist
Actual Results:  
Output:
  Failed to open the message catalog "man" for locale "sv_SE"
  (NLSPATH="/usr/share/locale/%L/%N")

  What manual page do you want?


Expected Results:  
Output:
  What manual page do you want?

emerge info output follows:

Portage 2.0.49-r20 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.24)
=================================================================
System uname: 2.4.24 i686 AMD Athlon(tm) processor
Gentoo Base System version 1.4.3.10
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.1/share/config /usr/kde/3/share/config /usr/share/config
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -march=athlon -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X alsa apm arts avi berkdb bonobo cdr crypt cups directfb encode esd
foomaticdb gdbm gif gpm gtk2 imlib java jpeg kde libg++ libwww mad mikmod motif
mozilla mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png postgres
python qt quicktime readline ruby sdl slang spell ssl svga tcpd tetex truetype
x86 xml2 xmms xv zlib linguas_sv"



Proposed fix - change the order in which man looks for locale related
environment variables to find message catalogs:

--- man-1.5l/src/gripes.c       2002-07-18 02:17:23.000000000 +0200
+++ man-1.5l/src/gripes.c       2004-01-09 22:37:17.000000000 +0100
@@ -41,11 +41,11 @@
               and LANG != "en" (or when debugging). Also accept en_ZA etc. */
            char *s, *lg;
            s = getenv("NLSPATH");
-           lg = getenv("LANG");
+           lg = getenv("LC_ALL");
            if (!lg)
                    lg = getenv("LC_MESSAGES");
            if (!lg)
-                   lg = getenv("LC_ALL");
+                   lg = getenv("LANG");
            if ((s || lg) && (!lg || strncmp(lg, "en", 2))) {
                perror(mantexts);
                fprintf(stderr,
Comment 1 SpanKY gentoo-dev 2004-02-08 12:58:12 UTC
does this apply to man-1.5m ?
Comment 2 Antti Mäkelä 2004-08-14 03:44:55 UTC
Apparently, there is a solution. Man (even version man-1.5m-r1) is broken. Check out URL 

http://linuxfromscratch.org/pipermail/lfs-support/2003-March/016106.html

I applied the changes, and now 'man' works just fine. 

I'm attaching a new ebuild with the patch that works fine for me. Please test and integrate into portage tree.
Comment 3 Antti Mäkelä 2004-08-14 03:49:36 UTC
Created attachment 37407 [details, diff]
Patch that fixes the catget problem (see comments)
Comment 4 Antti Mäkelä 2004-08-14 03:49:55 UTC
Created attachment 37408 [details]
Ebuild that uses the catgets patch
Comment 5 SpanKY gentoo-dev 2004-10-03 00:56:54 UTC
ok, thanks for doing the footwork :)

fixed in 1.5m-r2