From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] Gracefully handle incompatible locale data Date: Tue, 29 Sep 2015 10:08:53 +0200 Message-ID: <87io6t1wbu.fsf@gnu.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org In-Reply-To: <5609A8E9.7050201@redhat.com> (Carlos O'Donell's message of "Mon, 28 Sep 2015 16:54:01 -0400") To: Carlos O'Donell Cc: =?utf-8?B?T25kxZllaiBCw61sa2E=?= , libc-alpha@sourceware.org, guix-devel@gnu.org, Roland McGrath List-Id: guix-devel.gnu.org "Carlos O'Donell" skribis: > On 09/26/2015 06:24 AM, Ludovic Court=C3=A8s wrote: >> Furthermore, the function in question returns EINVAL in other similar >> cases=E2=80=93e.g., when libc 2.22 loads LC_COLLATE data from libc 2.21. > > If you change this particular case to EINVAL, what does the user see > as a result of this change? The user-visible change is that, if incompatible or broken locale data is found, a call like: setlocale (LC_ALL, ""); returns EINVAL instead of aborting. > Do they get a non-zero exit code from `localedef --list-archive` along > with an error written out to stderr? =E2=80=98localedef=E2=80=99 starts with: setlocale (LC_MESSAGES, ""); setlocale (LC_CTYPE, ""); so it will no longer abort when invalid locale data is found (although in the 2.21 =E2=86=92 2.22 transition, only the LC_COLLATE data format diff= ers anyway.) Apart from that, =E2=80=98localedef --list-archive=E2=80=99 simply opens th= e locale archive (typically /usr/lib/locale/locale-archive, regardless of the =E2=80=98LOCPATH=E2=80=99 environment variable value), so its behavior is u= nchanged. Am I overlooking something? > This is the kind of change I'm expecting. If we are removing an assertion, > we should be replacing it with something meaningful and verifying that > meaningful change. Yes, agreed. The function that is changed, =E2=80=98_nl_intern_locale_data=E2=80=99, has= only two callers in libc, and both check whether it returns NULL. So it seems to me that the code is not introducing anything new in the API contract. WDYT? Thank you, Ludo=E2=80=99.