]> git.ipfire.org Git - thirdparty/glibc.git/commit
localedef: Add verbose messages for failure paths.
authorCarlos O'Donell <carlos@redhat.com>
Wed, 8 Jan 2020 18:24:42 +0000 (13:24 -0500)
committerCarlos O'Donell <carlos@redhat.com>
Sun, 26 Apr 2020 17:55:58 +0000 (13:55 -0400)
commit92954ffa5a5662fbfde14febd7e5dcc358c85470
treeea7eb81874f0b3d706e701eda47f29718f7d948f
parent8d9ffbb9d00669f62d5ddb4283b7c3d03955d942
localedef: Add verbose messages for failure paths.

During testing of localedef running in a minimal container
there were several error cases which were hard to diagnose
since they appeared as strerror (errno) values printed by the
higher level functions.  This change adds three new verbose
messages for potential failure paths.  The new messages give
the user the opportunity to use -v and display additional
information about why localedef might be failing.  I found
these messages useful myself while writing a localedef
container test for --no-hard-links.

Since the changes cleanup the code that handle codeset
normalization we add tst-localedef-path-norm which contains
many sub-tests to verify the correct expected normalization of
codeset strings both when installing to default paths (the
only time normalization is enabled) and installing to absolute
paths.  During the refactoring I created at least one
buffer-overflow which valgrind caught, but these tests did not
catch because the exec in the container had a very clean heap
with zero-initialized memory. However, between valgrind and
the tests the results are clean.

The new tst-localedef-path-norm passes without regression on
x86_64.

Change-Id: I28b9f680711ff00252a2cb15625b774cc58ecb9d
include/programs/xasprintf.h [new file with mode: 0644]
locale/Makefile
locale/programs/localedef.c
locale/programs/localedef.h
locale/programs/xasprintf.c [new file with mode: 0644]
locale/tst-localedef-path-norm.c [new file with mode: 0644]
locale/tst-localedef-path-norm.root/postclean.req [new file with mode: 0644]
locale/tst-localedef-path-norm.root/tst-localedef-path-norm.script [new file with mode: 0644]
support/Makefile
support/support.h
support/support_paths.c