This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] locale: Fix localedef exit code [BZ #22292]


On 10/15/2017 02:34 PM, Andreas Schwab wrote:
> On Okt 15 2017, Carlos O'Donell <carlos@redhat.com> wrote:
> 
>> Which of (a) or (b) do you prefer?
> 
> I don't really have a preference.

Given that a locale can be used for much more than just ISO C, I'm
going to downgrade this to a verbose message that appears if you
compile the locale with `-v' to verify the locale compilation
in detail. The locale will compile with `-v' but will produce an
exit code of 1 because of the extra warnings enabled by verbose
e.g. field `country_post' not defined.

With the patch the locale compiles without warnings and localedef
exits with exit code 0 and the OpenSUSE build should succeed when
building the combination of ja_JP and SHIFT_JIS or SHIFT_JISX0213.

Tested on x86_64 with no regressions.
Tested by installing and compiling all SUPPORTED locales.
Tested by compiling ja_JP.SHIFT_JISX0213 and verifying exit code was 0.
Tested by compiling ja_JP.SHIFT_JIS and verifying exit code was 0.

OK to checkin?

2017-10-15  Carlos O'Donell  <carlos@redhat.com>

	* locale/programs/charmap.c (charmap_read): ASCII compatibility
	should only be a verbose message.
	* localedata/gen-locale.sh: All locales must compile cleanly
	with exit code 0.

diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index a670db9..72a37c6 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -256,8 +256,8 @@ charmap_read (const char *filename, int verbose, int error_not_found,
 
       if (failed)
        {
-         record_warning (_("\
-character map `%s' is not ASCII compatible, locale not ISO C compliant\n"),
+         record_verbose (stderr, _("\
+character map `%s' is not ASCII compatible, locale not ISO C compliant"),
                          result->code_set_name);
          enc_not_ascii_compatible = true;
        }
diff --git a/localedata/gen-locale.sh b/localedata/gen-locale.sh
index b4ec68c..deb09de 100644
--- a/localedata/gen-locale.sh
+++ b/localedata/gen-locale.sh
@@ -34,12 +34,7 @@ generate_locale ()
   ${localedef_before_env} ${run_program_env} I18NPATH=../localedata \
        ${localedef_after_env} --quiet -c -f $charmap -i $input \
        ${common_objpfx}localedata/$out || ret=$?
-  # All locales compile fine, except those with SHIFT_JIS charmap
-  # and those fail with exit code 1 because SHIFT_JIS issues a
-  # warning (it is not ASCII compatible).
-  if [ $ret -eq 0 ] \
-     || ( [ $ret -eq 1 ] \
-          && [ "$charmap" = "SHIFT_JIS" ] ); then
+  if [ $ret -eq 0 ]; then
     # The makefile checks the timestamp of the LC_CTYPE file,
     # but localedef won't have touched it if it was able to
     # hard-link it to an existing file.
---

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]