Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 163835 - LC_MESSAGES not respected by man as it should
Summary: LC_MESSAGES not respected by man as it should
Status: VERIFIED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
: 163543 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-25 23:01 UTC by impulze
Modified: 2009-12-19 19:20 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description impulze 2007-01-25 23:01:31 UTC
When specifying the LANG and LC_MESSAGES variables, LANG overwrites LC_MESSAGES for man.

This should not happen at all:
http://www.gnu.org/software/libc/manual/html_node/Locale-Categories.html#Locale-Categories

and

impulze@Istari ~ $ ebuild /usr/portage/sys-apps/man/man-1.6d.ebuild unpack > /dev/null && grep -r LC_MESSAGES /var/tmp/portage/man-1.6d/work/man-1.6d/HISTORY
- Prefer LC_MESSAGES over LANG


Reproducible: Always

Steps to Reproduce:
1. Generate two different locales (e.g. en_US.utf8 and de_DE.utf8)
2. Specify one as LANG and the other as LC_MESSAGES temporarily (or in
/etc/env.d/02locales and then run env-update and source /etc/profile)
3. fire up "man foobar" e.g. (LANG="de_DE.utf8" LC_MESSAGES="en_US.utf8" man
foobar)

Actual Results:  
The message given by man is written with the locale of the LANG variable.
e.g. "Keine Handbuchseite für foobar"

Expected Results:  
The message should be written with the locale of the LC_MESSAGES variable.
e.g. "No manual entry for foobar"

This overwriting only affects man, for gcc it works.
Example:
impulze@Istari ~ $ LANG=de_DE.utf8 LC_MESSAGES=en_US.utf8 gcc foo
gcc: foo: No such file or directory
gcc: no input files

Refers to bug 163543
http://bugs.gentoo.org/show_bug.cgi?id=163543
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-01-26 08:01:23 UTC
# LANG="cs_CZ.utf8" LC_MESSAGES="en_US.utf8" man foobar
No manual entry for foobar
# LANG="en_US.utf8" LC_MESSAGES="cs_CZ.utf8" man foobar
Žádný záznam pro foobar
# LANG="en_US.utf8" LC_MESSAGES="de_DE.UTF8" man foobar
No manual entry for foobar
# LANG="en_US.utf8" LC_MESSAGES="de_DE.utf8" man foobar
Keine Handbuchseite für foobar

HINT: sys-apps/man will *only* install the locales specifies in your LINGUAS.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-01-26 17:31:11 UTC
*** Bug 163543 has been marked as a duplicate of this bug. ***
Comment 3 jINKs 2007-01-27 09:40:50 UTC
OK Jakub, let's try to dumb this down to you level...

LC_MESSAGES is recognized by gcc, as it should be... 

$ LANG="de_DE.utf8" LC_MESSAGES="en_US.utf8" gcc foo 
gcc: foo: No such file or directory 
gcc: no input files 

$ LC_MESSAGES="de_DE.utf8" gcc foo 
gcc: foo: Datei oder Verzeichnis nicht gefunden 
gcc: keine Eingabedateien 


LC_MESSAGES is NOT recognized by man.
$ LANG="de_DE.utf8" LC_MESSAGES="en_US.utf8" man foo 
Keine Handbuchseite fr foo


Yes, this contains german, cope with it or make everyone happy and resign...
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2007-01-27 09:48:45 UTC
(In reply to comment #3)
> OK Jakub, let's try to dumb this down to you level...

Which part of "you must compile sys-apps/man with LINGUAS="de" to get your errors in German have you missed? It works perfectly fine here with 

[ebuild     U ] sys-apps/man-1.6e-r3 [1.6e-r2] USE="nls" 0 kB 

as shown above. If it doesn't work for you with another man version, then finally state so here and test the version above, so that we can get a working one stabilized; your ranting here is ot useful at all.
Comment 5 jINKs 2007-01-27 10:13:04 UTC
Oh my... you really don"t get it, do you?

Here again in big shiny letters:

MAN IS DISPLAYING _GERMAN_ WHE IT *SHOULD* INSTEAD DISPLAY _ENGLISH_ MESSAGES!

and

YES I HAVE BOTH LANGUES INSTALLED AND SET UP.

and

GCC *DOES* HONOR LC_MESSAGES, MAN *DOES NOT* - THIS IS A BUG!
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2007-01-27 10:32:00 UTC
Closing; reopen *after* you have tested the version mentioned in Comment #4 and *after* you have fixed your caps lock key. 

If it doesn't work for you with sys-apps/man-1.6e either, then post emerge -pv man output and emerge --info so that we actually get something useful here. Until then, take your capslocked screaming to /dev/null.
Comment 7 jINKs 2007-01-27 10:45:47 UTC
(11:36)[root@hydra]~ # paludis -pi sys-apps/man
Building target list... 
Building dependency list...

These packages will be installed:

* sys-apps/man-1.6e-r3 {:0} [R] nls

Total: 1 package (1 rebuild)

Use flags:

* nls:             Adds Native Language Support (using gettext - GNU locale utilities)

(11:37)[root@hydra]~ # paludis --info
paludis 0.16.0

Built by root@hydra on 2007-01-26T12:44:53+0100
CXX:         x86_64-pc-linux-gnu-g++ 4.1.1 (Gentoo 4.1.1-r3)
CXXFLAGS:    -march=nocona -O2 -pipe
LDFLAGS:     
DATADIR:     /usr/share
LIBDIR:      /usr/lib64
LIBEXECDIR:  /usr/libexec
SYSCONFDIR:  /etc
stdlib:      GNU libstdc++ 20060524
libebt:      1.3.0
libwrapiter: 1.0.0
sandbox:     enabled

Repository virtuals:
    Configuration information:
        format:                virtuals

Repository installed_virtuals:
    Configuration information:
        format:                installed_virtuals

Repository gentoo:
    Configuration information:
        buildroot:             /var/tmp/paludis
        cache:                 /usr/portage/metadata/cache
        distdir:               /var/portage/distfiles
        eclassdirs:            /usr/portage/eclass
        format:                ebuild
        location:              /usr/portage
        names_cache:           /usr/portage/.cache/names
        newsdir:               /usr/portage/metadata/news
        pkgdir:                /var/empty
        profiles:              /usr/portage/profiles/default-linux/amd64/2006.1
        root:                  /
        securitydir:           /usr/portage/metadata/glsa
        setsdir:               /usr/portage/sets
        sync:                  rsync://titan.huntemann.uni-oldenburg.de/gentoo-portage
        sync_options:          
        write_cache:           /var/cache/paludis/metadata

    Package information:
        app-admin/eselect-compiler: (none)
        dev-java/java-config:  1.3.7, 2.0.31-r3
        dev-lang/python:       2.4.4
        dev-python/pycrypto:   2.0.1-r5
        dev-util/ccache:       2.4-r6
        dev-util/confcache:    (none)
        sys-apps/sandbox:      1.2.18.1
        sys-devel/autoconf:    2.13, 2.61
        sys-devel/automake:    1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
        sys-devel/binutils:    2.17
        sys-devel/gcc-config:  1.3.14
        sys-devel/libtool:     1.5.22
        virtual/os-headers:    2.6.19.2-r1

    Variable information:
        ACCEPT_KEYWORDS:       
        AUTOCLEAN:             
        CBUILD:                x86_64-pc-linux-gnu
        CFLAGS:                -march=nocona -O2 -pipe
        CHOST:                 x86_64-pc-linux-gnu
        CONFIG_PROTECT:        /usr/share/X11/xkb
        CONFIG_PROTECT_MASK:   /etc/java-config/vms/ /etc/env.d/java/ /etc/gconf /etc/terminfo /etc/revdep-rebuild /etc/texmf/web2c
        CTARGET:               
        CXXFLAGS:              -march=nocona -O2 -pipe
        DISTDIR:               /var/portage/distfiles
        FEATURES:              
        GENTOO_MIRRORS:        
        INSTALL_MASK:          
        LANG:                  
        LC_ALL:                
        LDFLAGS:               
        LINGUAS:               de
        MAKEOPTS:              -j3
        PKGDIR:                
        PORTAGE_RSYNC_EXTRA_OPTS: 
        PORTAGE_RSYNC_OPTS:    
        PORTAGE_TMPDIR:        /var/tmp/paludis
        PORTDIR:               /usr/portage
        PORTDIR_OVERLAY:       
        SYNC:                  
        USE: 16bit 7zip X a52 aac acl acpi aiglx alsa ao aotuv audacious bash-completion branding buffysize bzip2 cairo cdda cddb chardet clamav dbus de_tvtoday djvu dmi dvd dvdnav dvdread dvi encode exo fbcon firefox flac fontconfig glitz glut gnutls gpg2-xperimental gpgme gtk gtkhtml hal hddtemp imap imlib iproute2 jack java jfs jpeg kqemu lcms libnotify lzo mad matroska md5sum mmkeys modplug mozbranding mp3 mp4 mpeg multiuser musepack nntp nsplugin ntfs nvidia oav offensive ogg opengl oprtaudi panel-plugin pdf png portaudio posix pulseaudio qdbm rar rtc rtsp samba sasl sdl sensord shout sid slang smime smp sndfile speex spell sqlite startup-notification stream svg symlink syslog theora threads thumbnail thunar thunar-vfs tiff timidity trayicon truetype v4l v4l2 vcd vfs vim vim-pager vim-syntax vim-with-x vlm vorbis vorbis-psy wma wxwindows xcomposite xext xinerama xosd xprint xv xvid xvmc zsh-completion zvbi javascript paludis srv x264 moznocompose moznoirc moznomail moznoroaming exif insecure-savers                  

Repository installed:
    Configuration information:
        buildroot:             /var/tmp/paludis
        format:                vdb
        location:              /var/db/pkg
        names_cache:           /var/db/pkg/.cache/names
        provides_cache:        /var/db/pkg/.cache/provides
        root:                  /
        world:                 /var/db/pkg/world

(11:41)[root@hydra]~ # locale-gen
 * Generating 5 locales (this might take a while) with 1 jobs
 *  (1/5) Generating en_US.ISO-8859-1
 *  (2/5) Generating en_US.UTF-8
 *  (3/5) Generating de_DE.ISO-8859-1
 *  (4/5) Generating de_DE.ISO-8859-15@euro
 *  (5/5) Generating de_DE.UTF-8 ...
 * Generation complete


(11:37)[root@hydra]~ # LANG="de_DE.utf8" LC_MESSAGES="en_US.utf8" man foo                                                                         (0)
Keine Handbuchseite f�r foo

sorry, no emerge here but all relevant info should be there...
as you can see, man-1.6e-r3 is installed (i tried with -r2 also) and still giving german output
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2007-01-27 10:50:16 UTC
> LINGUAS:               de

It will NOT work as you expect w/ LC_MESSAGES="en_US.utf8"; you need LINGUAS="de en" and that's exactly what I've been explaining here all the time. 

sys-apps/man *only* installs locales for specified LINGUAS. That has *nothing* to do with locale-gen and is *not* a bug.
Comment 9 jINKs 2007-01-27 11:12:35 UTC
OK, in this case it is still an ebuild bug sice sys-apps/man has no linguas_* in IUSE.
So either man should be fixed to honor locales or the ebuild should have proper LINUGUAS USE flags.

It should not be the users work to read the ebuild to find out why man isn't working the way it's expected to. (gcc handles this fine without LINGUAS, but i dont't know the inner workings of man, if man can't work without LINGUAS, IUSE it)
Comment 10 Jakub Moc (RETIRED) gentoo-dev 2007-01-27 11:19:18 UTC
(In reply to comment #9)
> So either man should be fixed to honor locales

Care to explain how should man honor locales that are NOT installed? Should probably invent them on-the-fly? Set your LINGUAS properly, i.e. stick *both* en and de there if you want to use *both* English and German locales. Locales not installed don't get honored because they don't exist; pretty simple.
Comment 11 impulze 2007-01-27 11:29:31 UTC
Wouldn't that mean, that i would automatically install stuff i don't like (e.g. kde-i18n, amarok, vlc, what not) with english locales/language specific stuff which i don't like or don't want? Just because i want to have english man output? Or did i get this wrong?
Comment 12 jINKs 2007-01-27 11:32:09 UTC
(In reply to comment #10)
> Locales
> not installed don't get honored because they don't exist; pretty simple.

then, why does gcc work this way?
besides:  (12:04)[root@hydra]~ # locale -a | grep en
 en_US
 en_US.utf8

So locaes are installed, but the sys-app/man ebuild does read LINGUAS (e.g. 
mylang="${LINGUAS// /,}" ), without mentioning this in IUSE, so one cannot see
that one has to set LINGUAS=en to get english messages from man with just using
emerge -pv. Which as far as I can see makes sys-apps/man abusing LINGUAS.
Comment 13 Jakub Moc (RETIRED) gentoo-dev 2007-01-27 11:37:47 UTC
(In reply to comment #11)
> Wouldn't that mean, that i would automatically install stuff i don't like (e.g.
> kde-i18n, amarok, vlc, what not) with english locales/language specific stuff
> which i don't like or don't want? Just because i want to have english man
> output? Or did i get this wrong?

Inconsistent LINGUAS handling across completely unrelated stuff it definitely outside the scope of this bug, and outside the scope of Gentoo bugzilla altogether. Complain upstream if something doesn't follow the GNU suggestions. 

Wrt the above; echo "cat-egory/package -linguas_en >> /etc/portage/package.use" for ebuilds that actually *do* honor LINGUAS="en" and USE="linguas_en" will do exactly what you want.

(In reply to comment #12)
> then, why does gcc work this way?
> besides:  (12:04)[root@hydra]~ # locale -a | grep en
>  en_US
>  en_US.utf8
> So locaes are installed, but the sys-app/man ebuild does read LINGUAS (e.g. 
> mylang="${LINGUAS// /,}" ), without mentioning this in IUSE, so one cannot 

No, man locales are NOT installed. locale-gen is glibc-only thing, has nothing to do with any other ebuild in portage and won't install localization for any other ebuild in portage.

Period, closed case; no need for further comments here.
Comment 14 jINKs 2007-01-27 11:49:54 UTC
(In reply to comment #13)
> Period, closed case; no need for further comments here.
> 
Just ONE more question

> Inconsistent LINGUAS handling across completely unrelated stuff it definitely
> outside the scope of this bug, and outside the scope of Gentoo bugzilla
> altogether. Complain upstream if something doesn't follow the GNU suggestions. 
> 
LINGUAS is a portage/ebuild thing so this, in fact, shold be reported to the sys-apps/man ebuild maintainer.

> Wrt the above; echo "cat-egory/package -linguas_en >> /etc/portage/package.use"
> for ebuilds that actually *do* honor LINGUAS="en" and USE="linguas_en" will do
> exactly what you want.

So you are suggesting modifying USE flags for EVER SINGLE other multilang ebuild just because sys-apps/man misbehaves? Sorry, but I think fixing sys-apps/man is the more reasonable option.
Since this discussion is mostly unrelated I would opt for filing a new bug against sys-apps/man regarding the LINGUAS/USE-Flag issue.
Comment 15 Jakub Moc (RETIRED) gentoo-dev 2007-01-27 11:56:12 UTC
(In reply to comment #14)
> LINGUAS is a portage/ebuild thing so this, in fact, shold be reported to the
> sys-apps/man ebuild maintainer.

Uh no, absolutely not a portage/ebuild specific thing. Go do some research before stating such stuff.

> So you are suggesting modifying USE flags for EVER SINGLE other multilang
> ebuild just because sys-apps/man misbehaves? Sorry, but I think fixing
> sys-apps/man is the more reasonable option.

Move to Bug 136953 and stop the noise here before I get really angry and will start eating bugzilla accounts for lunch. I'm pretty serious about this; stop flooding my mailbox.
Comment 16 Marcin Cieślak 2009-12-19 19:20:01 UTC
I have:
(from emerge --info -pv)

sys-apps/man-1.6f-r3 was built with the following:
USE="(multilib) nls -lzma

There is one case the method in comment 4 does not work:

LANG="pl_PL.UTF-8" man foobar
Nie ma strony podrêcznika dla foobar

This is correct.
(well, the messages is ISO-8859-2 but this is another matter...)

LANG="pl_PL.UTF-8" LC_MESSAGES="en_US.UTF-8" man foobar
No manual entry for foobar

This is what is expected.

However:

LANG="pl_PL.UTF-8" LC_MESSAGES="C" man foobar
Nie ma strony podrêcznika dla foobar

So "C" locale is not respected.

Another thing (another bug maybe?) is that with LC_MESSAGES seems to be ignored when picking up a language version of the man page (only setting LANG works).

So:

LANG="pl_PL.UTF-8" LC_MESSAGES="en_US.UTF-8" man ls

gives a Polish language version

LANG="pl_PL.UTF-8" LC_MESSAGES="C" man ls

gives a Polish language version

Having this installed:

app-i18n/man-pages-pl-20070628
sys-apps/man-1.6f-r3
sys-apps/man-pages-3.22
sys-apps/man-pages-posix-2003a

I can't tell the system to use English language manual pages, except for uninstalling app-i18n/man-pages-pl-20070628.

Seems like the manpath selection logic is botched:

276 add_to_mandirlist (char *dir, int perrs) {
277         char *lang;
278 
279         if (alt_system) {
280                 add_to_list(dir, alt_system_name, perrs);
281         } else {
282                 /* We cannot use "lang = setlocale(LC_MESSAGES, NULL)" or s    o:
283                    the return value of setlocale is an opaque string. */
284                 /* POSIX prescribes the order: LC_ALL, LC_MESSAGES, LANG */
285                 if((lang = getenv("LC_ALL")) != NULL)
286                         split2(dir, lang, add_to_mandirlist_x, perrs);
287                 if((lang = getenv("LC_MESSAGES")) != NULL)
288                         split2(dir, lang, add_to_mandirlist_x, perrs);
289                 if((lang = getenv("LANG")) != NULL)
290                         split2(dir, lang, add_to_mandirlist_x, perrs);
291                 if((lang = getenv("LANGUAGE")) != NULL)
292                         split2(dir, lang, add_to_mandirlist_x, perrs);
293                 add_to_mandirlist_x(dir, 0, perrs);
294         }
295 }

The code above seems to add LANG-derived language code always to the manpath, even if it's overriden by LC_MESSAGES. And I think such selection does not work
when specific preference to "C" locale is indicated.