From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11150 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: a bug in bindtextdomain() and strip '.UTF-8' Date: Fri, 17 Mar 2017 15:37:40 -0400 Message-ID: <20170317193740.GM1693@brightrain.aerifal.cx> References: <20170211023610.GA1520@brightrain.aerifal.cx> <20170212023422.GE1520@brightrain.aerifal.cx> <20170213132816.GG1520@brightrain.aerifal.cx> <20170213171236.GI1520@brightrain.aerifal.cx> <20170317192749.GL1693@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1489779473 1807 195.159.176.226 (17 Mar 2017 19:37:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Mar 2017 19:37:53 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11165-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 17 20:37:50 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1coxh6-0008Vj-0S for gllmg-musl@m.gmane.org; Fri, 17 Mar 2017 20:37:48 +0100 Original-Received: (qmail 9872 invoked by uid 550); 17 Mar 2017 19:37:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 9851 invoked from network); 17 Mar 2017 19:37:51 -0000 Content-Disposition: inline In-Reply-To: <20170317192749.GL1693@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11150 Archived-At: On Fri, Mar 17, 2017 at 03:27:49PM -0400, Rich Felker wrote: > + /* Logically split @mod suffix from locale name. */ > + modname = memchr(locname, '@', loclen); > + if (!modname) modname = locname + loclen; > + alt_modlen = modlen = loclen - (modname-locname); > + loclen = modname-locname; > + > + /* Drop .charset identifier; it is not used. */ > + const char *csp = memchr(locname, '.', loclen); > + if (csp) loclen = csp-locname; > + > + char name[dirlen+1 + loclen+1 + catlen+1 + domlen+3 + 1]; > + const void *map; One bug in my version: loclen+1 should be loclen+modlen+1. Without changing that, the pathname gets truncated if @mod is used. Otherwise it seems to work. One separate but related problem I noticed while testing is that musl's locale name length limit of 16 is insufficient for something like "en_GB.UTF-8@euro". If we want to allow users to have an explicit ".UTF-8" in the locale name (which, as we discussed a while back, users may want to do if they plan to ssh into glibc-based systems) then we should probably increase this limit a bit, perhaps to 24 or so. Rich