[Bug 1577460] Re: mkinitramfs --help > Core dumped
Martin Pitt
martin.pitt at ubuntu.com
Wed Oct 5 11:51:25 UTC 2016
I've tried (in vain so far) to understand what's going on and how this
is related to the locale-langpack/ search path patch.
Tested/reproduced with
LC_ALL=fo_FOO gdb --args getopt -o c:d:ko:r:v -n /usr/sbin/mkinitramfs
-- --help
Some observations:
* This crash doesn't happen with looking up LC_MESSAGES, only in this
getopt case with LC_IDENTIFICATION. The mere presence of
/usr/lib/locale/fo_FOO/LC_IDENTIFICATION in the search path causes this
crash. If *only* /usr/lib/locale/fo/LC_IDENTIFICATION gets added (and
not also the more specific fo_FOO one) then things still work.
* In all cases the returned list from _nl_make_l10nflist() was correct
in memory, so I suppose this triggers some bug (insufficiently large
buffer or so) somewhere else. Nevertheless we need to be bug compatible
with that.
During that I also noticed some bugs in the patch:
malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
- * (1 << pop (mask))
+ * 2 * (1 << pop (mask))
We shouldn't allocate 2* the number here, just argz_count() + 1, as we
are only adding one more search path.
Also we should correctly interleave lookups in /usr/share/locale-
langpack/ with /usr/share/locale wrt. the mask -- i. e. we should
*first* check if there is a more specific locale (with territory,
encoding, etc.) in /usr/share/locale-langpack/ and then check more
generic locales in both places.
But if I just fix these two bugs, then getopt still crashes on getting
too many LC_IDENTIFICATION search paths. So one proposal would be to
only do the locale-langpack/ lookup for LC_MESSAGES, not for any other
category; our langpacks only ship LC_MESSAGES anyway, so we make the
scope of this small enough to avoid triggering the crash.
** Patch added: "fixed debian/patches/ubuntu/local-altlocaledir.diff"
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1577460/+attachment/4755012/+files/local-altlocaledir.diff
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1577460
Title:
mkinitramfs --help > Core dumped
Status in Ubuntu on IBM z Systems:
Confirmed
Status in glibc package in Ubuntu:
Confirmed
Status in glibc source package in Xenial:
Confirmed
Bug description:
Problem Description
==============================
root at zlin060:~# mkinitramfs --help
Segmentation fault (core dumped)
W: non-GNU getopt
root at zlin060:~#
== Comment: #9 - Heinz-Werner Seeck <heinz-werner_seeck at de.ibm.com> - 2016-05-02 10:09:34 ==
With Ubuntu 14.40 login via ssh:
Following cmd :
'getopt -o c:d:ko:r:v -n /usr/sbin/mkinitramfs -- --help'
Following call-stack occured (creates coredump):
#0 __strncmp_c (s1=0x2e6575634a500a6d <error: Cannot access memory at address 0x2e6575634a500a6d>,
s1 at entry=0x2e6575634a500a6a <error: Cannot access memory at address 0x2e6575634a500a6a>,
s2=0x3fff7fff7ae "p", s2 at entry=0x3fff7fff7ab "gelp", n=n at entry=4) at ../string/strncmp.c:44
#1 0x000003ff7e9d4252 in _getopt_internal_r (argc=<optimized out>, argv=0x40,
optstring=0x200000030 <error: Cannot access memory at address 0x200000030>, longopts=<optimized out>,
longind=<optimized out>, long_only=0, d=0x3ff7ea8c330 <getopt_data>, posixly_correct=0) at getopt.c:546
#2 0x000003ff7e9d51f2 in _getopt_internal (argc=<optimized out>, argv=<optimized out>,
optstring=<optimized out>, longopts=<optimized out>, longind=0x3fff7ffe674, long_only=0, posixly_correct=0)
at getopt.c:1175
#3 0x000003ff7e9d52b6 in getopt_long (argc=<optimized out>, argv=<optimized out>, options=<optimized out>,
long_options=<optimized out>, opt_index=0x3fff7ffe674) at getopt1.c:65
#4 0x000002aa236821d8 in ?? ()
#5 0x000002aa23681c22 in main ()
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-z-systems/+bug/1577460/+subscriptions
More information about the foundations-bugs
mailing list