diff options
author | Carlos O'Donell <carlos@redhat.com> | 2020-01-08 13:24:42 -0500 |
---|---|---|
committer | Carlos O'Donell <carlos@redhat.com> | 2020-04-26 13:55:58 -0400 |
commit | 92954ffa5a5662fbfde14febd7e5dcc358c85470 (patch) | |
tree | ea7eb81874f0b3d706e701eda47f29718f7d948f /support | |
parent | 8d9ffbb9d00669f62d5ddb4283b7c3d03955d942 (diff) | |
download | glibc-92954ffa5a5662fbfde14febd7e5dcc358c85470.tar glibc-92954ffa5a5662fbfde14febd7e5dcc358c85470.tar.gz glibc-92954ffa5a5662fbfde14febd7e5dcc358c85470.tar.bz2 glibc-92954ffa5a5662fbfde14febd7e5dcc358c85470.zip |
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
Diffstat (limited to 'support')
-rw-r--r-- | support/Makefile | 3 | ||||
-rw-r--r-- | support/support.h | 2 | ||||
-rw-r--r-- | support/support_paths.c | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/support/Makefile b/support/Makefile index 6e38b87ebe..9364f3bd3e 100644 --- a/support/Makefile +++ b/support/Makefile @@ -189,7 +189,8 @@ CFLAGS-support_paths.c = \ -DLIBDIR_PATH=\"$(libdir)\" \ -DBINDIR_PATH=\"$(bindir)\" \ -DSBINDIR_PATH=\"$(sbindir)\" \ - -DROOTSBINDIR_PATH=\"$(rootsbindir)\" + -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \ + -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" ifeq (,$(CXX)) LINKS_DSO_PROGRAM = links-dso-program-c diff --git a/support/support.h b/support/support.h index 77d68c2aba..8e1a6a17f7 100644 --- a/support/support.h +++ b/support/support.h @@ -112,6 +112,8 @@ extern const char support_bindir_prefix[]; extern const char support_sbindir_prefix[]; /* Corresponds to the install's sbin/ directory (without prefix). */ extern const char support_install_rootsbindir[]; +/* Corresponds to the install's compiled locale directory. */ +extern const char support_complocaledir_prefix[]; extern ssize_t support_copy_file_range (int, off64_t *, int, off64_t *, size_t, unsigned int); diff --git a/support/support_paths.c b/support/support_paths.c index 9f10879722..edc6511304 100644 --- a/support/support_paths.c +++ b/support/support_paths.c @@ -78,3 +78,10 @@ const char support_install_rootsbindir[] = ROOTSBINDIR_PATH; #else # error please -DROOTSBINDIR_PATH=something in the Makefile #endif + +#ifdef COMPLOCALEDIR_PATH +/* Corresponds to the install's compiled locale directory. */ +const char support_complocaledir_prefix[] = COMPLOCALEDIR_PATH; +#else +# error please -DCOMPLOCALEDIR_PATH=something in the Makefile +#endif |