From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Carlos O'Donell" Subject: Re: [PATCH] Gracefully handle incompatible locale data Date: Wed, 28 Oct 2015 01:38:57 -0400 Message-ID: <56305F71.2020304@redhat.com> References: <876132lbic.fsf@gnu.org> <20150922191804.GA13637@domone> <877fnijgin.fsf@gnu.org> <20150922215022.GA27201@domone> <8737y4hkrz.fsf@gnu.org> <20150924082755.GA4767@domone> <87h9mjeqyy.fsf@gnu.org> <5605BA8D.40907@redhat.com> <87h9mh5vgn.fsf@gnu.org> <5609A8E9.7050201@redhat.com> <87io6t1wbu.fsf@gnu.org> <561D078A.5080307@redhat.com> <87si5en7y9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrJRx-0001pB-8C for guix-devel@gnu.org; Wed, 28 Oct 2015 01:39:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrJRt-00043H-7b for guix-devel@gnu.org; Wed, 28 Oct 2015 01:39:05 -0400 In-Reply-To: <87si5en7y9.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= Cc: guix-devel@gnu.org, =?UTF-8?B?T25kxZllaiBCw61sa2E=?= , libc-alpha@sourceware.org, Roland McGrath On 10/13/2015 10:45 AM, Ludovic Court=C3=A8s wrote: >> - What does localedef --list-archive return? >> >> - The new LC_COLLATE format will make it's way into the binary local= e archive >> and that means glibc can't read the locale-archive? Does it fail? = exit code? >=20 > The patch does not change how locale archives are handled. >=20 > I think we=E2=80=99re confusing locale archive and locale data; or am I= simply > missing something? :-) Your patch is OK. Notes: (1) Do we return NULL and EINVAL? Yes. Loading locale data from the locale archive uses _nl_load_locale_from_arc= hive. The function _nl_load_locale_from_archive calls _nl_intern_locale_data which can trigger the assert on invalid type sizes. ~~~ locale/loadarchive.c ~~~ 134 _nl_load_locale_from_archive (int category, const char **namep) ... 478 lia->data[cnt] =3D _nl_intern_locale_data (cnt, 479 results[cnt].addr, 480 results[cnt].len); ~~~ Which seems like it can trigger the assertion when loading the larger LC_COLLATE data from the archive. Now we return NULL, ignore the failed l= oad, and potentially return NULL again since `lia->data[category]` is now NULL= . This means `_nl_find_locale` returns NULL, and then functions like `setlo= cale` appear to return NULL to indicate no data was loaded with errno set to EI= NVAL. (2) Does localedef --list-archive work? Yes. It is unaffected by the LC_COLLATE changes since the locale archive = records have explicit length and can be listed even when they can't be loaded. Th= is is wrong IMO, and we should have done something to detect the invalid LC_COL= LATE and print a warning, but that's another QoI issue unrelated to the patch = you're trying to apply. c.