DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52P95PKk2598300
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 52P95PKk2598300
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=tWyxfzo3
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7D6F385771D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1742893523;
	bh=qddf2Re7GqUS1oDHCjihlXsgHs3RK5YfPbtcK+iobAo=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=tWyxfzo36MuqBBpa4VUIhF16zZAttlsI6LhxK2zfxqHMW6JmCkrBJYJ81Grv4iAFs
	 p3pwzJEPT/QuwBu1ZX+wwXl8T7aSpUZzhgnHAxa0WFxcAx2v9pXLDhnLOLJrAmAXrV
	 kUc7Vn+9VD0prILTQSLqKWiEFF5Kc2ayyJ0CZBN8=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A19043857820
Date: Tue, 25 Mar 2025 10:04:20 +0100
To: cygwin@cygwin.com
Subject: Re: two bugs in getlocalename_l
Message-ID: <Z-JxlLL2eWjAUMxQ@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com, Bruno Haible <bruno@clisp.org>
References: <4134860.iTQEcLzFEP@nimes> <Z-GSfgjYaICmrYQY@calimero.vinschen.de>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <Z-GSfgjYaICmrYQY@calimero.vinschen.de>
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>,
        Bruno Haible <bruno@clisp.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

Hi Bruno,

On Mar 24 18:12, Corinna Vinschen via Cygwin wrote:
> On Mar 24 14:12, Bruno Haible via Cygwin wrote:
> > Hi,
> > 
> > It's good to see the addition of getlocalename_l from POSIX [1] in Cygwin 3.6.0.
> > 
> > [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/getlocalename_l.html
> > 
> > However, there are two bugs:
> > 
> > 
> >   - "If
> >      the value is LC_ALL or is not a supported locale category value (see
> >      <<setlocale>>), <<getlocalename_l>> shall fail."
> >     No, that's now how it is specified.
> >     <https://www.austingroupbugs.net/view.php?id=1220> specified it this
> >     way, but <https://www.austingroupbugs.net/view.php?id=1741> added the
> >     LC_ALL support.
> 
> Drat.  I implemented this prior to id=1741.  This is unfortunate.
> 
> Without LC_ALL, only a single per-thread buffer of size ENCODING_LEN+1
> was required to allow LC_GLOBAL_LOCALE.
> 
> With LC_ALL and with the extra requirement that only a call to
> getlocalename_l(LC_GLOBAL_LOCALE) overwrites the per-thread
> LC_GLOBAL_LOCALE string buffer, we now need 2 per-thread buffers 
> of size _LC_LAST * (ENCODING_LEN+1).
> 
> >   - "<<getlocalename_l>> is POSIX-1.2008 since Base Specification Issue 8"
> >     No, it was introduced in POSIX-1.2024.
> 
> Yeah, that was temporary because the nameof the new standard wasn't
> known at the time I added this.

I fixed the comment and the invalid return value when specifying
LC_GLOBAL_LOCALE, as well as adding LC_ALL handling per the POSIX
specs.

The changes will be in test release cygwin-3.7.0-0.14.ga0fe984953dd
and in 3.6.1.


Thanks,
Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
