Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 97541 - sys-apps/man-1.6 with nls flag segfaults on non-english locales
Summary: sys-apps/man-1.6 with nls flag segfaults on non-english locales
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://forums.gentoo.org/viewtopic-t-...
Whiteboard:
Keywords:
: 97614 97721 97803 98643 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-30 13:41 UTC by Mario Hein
Modified: 2005-08-23 10:44 UTC (History)
11 users (show)

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


Attachments
ltrace of man userdel (man.userdel.ltrace,1.27 MB, text/plain)
2005-07-01 07:32 UTC, Martin von Gagern
Details
man-1.6-message-order.patch (man-1.6-message-order.patch,769 bytes, patch)
2005-07-01 08:49 UTC, Martin von Gagern
Details | Diff
patch to man-1.6.ebuild (man-1.6.patch,885 bytes, patch)
2005-07-01 08:53 UTC, Martin von Gagern
Details | Diff
man-1.6a.ebuild (man-1.6a.ebuild,2.63 KB, text/plain)
2005-08-23 07:06 UTC, Martin von Gagern
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Hein 2005-06-30 13:41:20 UTC
When opening some man pages (userdel, rm,...), an error is reportet.
No man page appears.
I switched back to man-1.5p. Now everything is fine again...
This error occurs only to some (let me guess... 30%? of all man pages)

Reproducible: Always
Steps to Reproduce:
1.update to man-1.6
2.enter: man userdel
3.



Expected Results:  
*huh* bring me a beer?
mh... or at least show me the man page i requested
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-06-30 13:51:51 UTC
`man userdel` and `man rm` both work for me; emerge --info, please. Also please
port the error you encounter.
Comment 2 Carsten Lohrke (RETIRED) gentoo-dev 2005-07-01 05:57:19 UTC
There's more than one person in the german partof forums.g.o mentioning this
problem and while I don't face such issues, man pages do not get cached for me
(anymore?). The relevant category directories stay empty, even though man.conf
isn't modified not to cache and permissions are fine.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2005-07-01 06:10:24 UTC
Adding the forums URL.

@carlo: Speicherzugriffsfehler = error accessing memory or something like that?
Comment 4 SpanKY gentoo-dev 2005-07-01 06:36:41 UTC
so man-1.5p works fine ?  what do you have your language settings to ? (i dont
know because you neglected to provide `emerge info`)
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-07-01 06:51:12 UTC
*** Bug 97614 has been marked as a duplicate of this bug. ***
Comment 6 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2005-07-01 06:57:43 UTC
Hi,

Speicherzugriffsfehler = segmentation fault (imho)

Poly
Comment 7 Alexander Stoll 2005-07-01 06:58:56 UTC
I can confirm this issue, it is triggered from locale setting, uncached man
pages with locale set to "de_DE@euro" cause a segfault of /usr/bin/man, cached
man pages and uncached man pages with locale set to "en_EN" show up properly...

Please mask version 1.6 and test this package further, version 1.5p lacks no
vital features and having no functional man pages is really annoying...

Gentoo Base System version 1.6.12
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.200
41102-r1, 2.4.31-grsec i686)
=================================================================
System uname: 2.4.31-grsec i686 Pentium III (Katmai)
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, Apr 30 2005, 16:53:41)]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentiumpro -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/
config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentiumpro -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/
distributions/gentoo"
LC_ALL="de_DE@euro"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 activefilter bitmap-fonts bzlib crypt ctype dbm emboss erandom ethereal
 flatfile fortran ftp gdbm gnutls hardened icc ifc maildir mbox memlimit mhash m
ime mmap mmx mp3 mysqli ncurses nls pam pcntl pcre perl pic pie posix readline r
ecode sasl shared sharedmem slang sockets socks5 sse ssl sysvipc szip tcpd truet
ype-fonts type1-fonts unicode zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 8 Martin von Gagern 2005-07-01 07:32:30 UTC
Created attachment 62407 [details]
ltrace of man userdel

1. LANG=de_DE man userdel => SEGFAULT
2. LANG=      man userdel => works
3. LANG=de_DE man userdel => works
4. rm /var/cache/man/cat8/userdel.8.bz2
5. LANG=de_DE ltrace -s255 man userdel => attached

The segfault occurs in vfprintf, the message translates to:
"File %s could not be opened for output"
Comment 9 Martin von Gagern 2005-07-01 08:49:54 UTC
Created attachment 62412 [details, diff]
man-1.6-message-order.patch

OK, here ist the solution. Those guys added some messages in the english
message file only, and not at the end but somewhere in between, with the
messages identified by position. So man got the wrong message, one containing a
%s where no argument was supplied in the call, resulting in this segmentation
fault.

I'll try to take this upstream as well.
Comment 10 Martin von Gagern 2005-07-01 08:53:52 UTC
Created attachment 62413 [details, diff]
patch to man-1.6.ebuild

Patch ebuild to apply attachment 62412 [details, diff] and solve bug 97612 as well.
Comment 11 Alessio Cassibba (X-Drum) 2005-07-02 08:27:37 UTC
*** Bug 97721 has been marked as a duplicate of this bug. ***
Comment 12 SpanKY gentoo-dev 2005-07-02 10:38:55 UTC
have you e-mailed upstream yet ?  if not i can do so ...
Comment 13 Jakub Moc (RETIRED) gentoo-dev 2005-07-03 03:27:31 UTC
*** Bug 97803 has been marked as a duplicate of this bug. ***
Comment 14 Martin von Gagern 2005-07-03 14:59:30 UTC
(in reply to comment #12)
July 1 I did send an email to flucifredi at acm. No reply so far. But It's been
weekend, so let's wait a hope for the best.
In the meantime I think you should apply the patch at distribution level, since
those segfaults are rather annoying to ~ARCH users.
Comment 15 Marek Kwasceki 2005-07-05 07:05:48 UTC
so now is two days since last post and no sign of amend in emerge?
Comment 16 Martin von Gagern 2005-07-05 07:51:58 UTC
Still no news from upstream. SpanKY, perhaps you can give this issue more weight
by sending an email as well, as you offered in comment #12.
Anyway, I fear this might take some time, so please include the patch in portage.
Comment 17 Martin von Gagern 2005-07-05 14:20:38 UTC
Mail from the upstream maintainer; he'll look into it next week.
Comment 18 Roel Brook 2005-07-05 18:58:18 UTC
there's something odd here:

Medusa% man dig
zsh: segmentation fault  man dig
Medusa% strace man dig
<snip>
open("/usr/share/locale/nl_NL@euro/LC_MESSAGES/man", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/share/locale/nl/man", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=6000, ...}) = 0
mmap2(NULL, 6000, PROT_READ, MAP_PRIVATE, 4, 0) = 0xa7e32000
close(4)                                = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Medusa% strace man dig > bla
<snip>
Medusa% cat bla
DIG(1)                                                                  DIG(1)



NAME
       dig - DNS lookup utility
<snip>
BUGS
       There are probably too many query options.



BIND9                            Jun 30, 2000                           DIG(1)

The man page does show up!

LC_ALL = nl_NL@euro

"info dig" also works. Because info can also show man pages, this can be used as
a temporary workaround.
Comment 19 Martin von Gagern 2005-07-06 01:29:12 UTC
As far as I could see from gripes.c, the precedence of locale environment
variables is reversed for man; LANG has precedence over LC_MESSAGES has
precedence over LC_ALL. I think I'll report this as a bug upstream as well.

(in reply to comment #18)
Please also state the settings of those other variables. It would be also
interesting which of those operations were executed as root and which as a
normal user. Because man is usually setgid man to access the man page cache, it
should by impossible to strace man as a normal user. And for root you usually
should not have set locale, so probably the page got formatted correctly while
stracing as root? The message when man failed for me was about the man page
being formatted, so for all pages that were already in the cache, man worked
fine. To reproduce the bug, you might have to remove
/var/cache/man/cat8/userdel.8.bz2.
Comment 20 Roel Brook 2005-07-06 15:59:13 UTC
you're right:

Medusa% man dig
zsh: segmentation fault  man dig
Medusa% sudo man dig
Formatting page, please wait...
<man page displays correctly>


Medusa% cat /etc/env.d/02locale
LC_ALL=nl_NL@euro
LANG=nl_NL@euro
LANGUAGE=nl_NL@euro
LINGUAS="nl"

All of the commands in #18 were done as a normal user. The enviroment settings
for all users on my system are the same:

Medusa% echo $LANG
nl_NL@euro
Medusa% echo $LC_MESSAGES

Medusa% echo $LC_ALL
nl_NL@euro
Medusa% su
Password:
Medusa# echo $LANG
nl_NL@euro
Medusa# echo $LC_MESSAGES

Medusa# echo $LC_ALL
nl_NL@euro

setting the LC_MESSAGES enviroment variable fixed it for me as normal user:
Medusa% LC_MESSAGES="nl_NL@euro" man dig
<page displays correctly!>
Medusa% LC_MESSAGES="aaaa" man dig
<page displays correctly>

I guess this is the whole problem: LC_MESSAGES should be set (or at least, not
be blank, except for the root user.

After adding LC_MESSAGES="nl_NL@euro" to /etc/env.d/02locale, I can use man
again. (without the patch)
Comment 21 Martin von Gagern 2005-07-06 16:14:25 UTC
There is some strange behaviour in the man sources with respect to which
environment variables are used where. Notice that LC_ALL is AFAIK indended as an
override; you set this only if you simply want to switch "everything"
temporarily. Otherwise you set LANG for defaults, and can fine tune different
locale categories by setting different LC_* variables to other settings. So LANG
is default, LC_* is more specific, and LC_ALL is override. All those settings
are neatly printed by locale(1p), which is a lot easier than echoing all those
variables manually.

A simple "su" takes large portions of the user environment with it, the cleaner
approach would be "su -", which might set those settings differently.

I'm still surprised that simply setting LC_MESSAGES seems to solve the problem
for you. I know from the sources that it will still fail if it tries to display
some unlucky message. Somehow setting this variable seems to have deactivated
output of those messages during default operation for you. Strange. But I don't
believe this to be a viable workaround for everybody.

So please include patch in portage soon! I met another bunch of people today who
"solved" the issue by removing the category subdirs of the cache, thus
suppressing the "formatting..." message. But this is not the way it should be.
Comment 22 Kamil Gornik 2005-07-08 00:40:07 UTC
nope, 
/home/heimat> locale
LANG=pl_PL
LC_CTYPE="pl_PL"
LC_NUMERIC="pl_PL"
LC_TIME="pl_PL"
LC_COLLATE="pl_PL"
LC_MONETARY="pl_PL"
LC_MESSAGES="pl_PL"
LC_PAPER="pl_PL"
LC_NAME="pl_PL"
LC_ADDRESS="pl_PL"
LC_TELEPHONE="pl_PL"
LC_MEASUREMENT="pl_PL"
LC_IDENTIFICATION="pl_PL"
LC_ALL=pl_PL
 (the same for root) 

and 
>man fdisk segfaults (user)
#man [sth] segfaults (root)
Comment 23 SpanKY gentoo-dev 2005-07-09 15:49:07 UTC
added to man-1.6-r1

please post any updates you receive from the man author, thanks
Comment 24 Jakub Moc (RETIRED) gentoo-dev 2005-07-11 04:28:59 UTC
*** Bug 98643 has been marked as a duplicate of this bug. ***
Comment 25 Martin von Gagern 2005-08-23 07:06:15 UTC
Created attachment 66650 [details]
man-1.6a.ebuild

Frederico Lucifredi released a minor fix, man-1.6a, to address this bug as well
as the parallel make issue. The attached ebuild seems to work, although it
perhaps should be tested some more.

Frederico wrote that he is "planning to review the internationalization and
coherence of the environment use in the upcoming minor releases".
Comment 26 SpanKY gentoo-dev 2005-08-23 10:44:44 UTC
1.6a is already in portage :P