From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D25201F5A0 for ; Mon, 6 Feb 2023 15:10:32 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YQB9maih; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP36z-00078A-Mb; Mon, 06 Feb 2023 10:08:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP36x-00074n-N7 for bug-gnulib@gnu.org; Mon, 06 Feb 2023 10:08:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP36l-0000QB-6H for bug-gnulib@gnu.org; Mon, 06 Feb 2023 10:08:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675696117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ajhvl/scnDnnP1MoVsExbiL/+V1eLtnmh2LNUi33Uwg=; b=YQB9maih+WgZfeZqanH+X2UAHeu4qZzfzQe6iUSA4VviYLyfLhFm0ddvlM/mjW2ZrDAtuj yNCMlYwr0tFzREdmYcT7sar6x9baaOBsXfUu2z7zfX0et+OpFUT41V2COv5pN8jzwnRiBG +5ApnXCsCnlRf339X4cdlQ14r04ObRE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-333-9CSxp9EkPDOAo_7kTS29xg-1; Mon, 06 Feb 2023 10:08:34 -0500 X-MC-Unique: 9CSxp9EkPDOAo_7kTS29xg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 393113C14850; Mon, 6 Feb 2023 15:08:34 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.192.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13A7F2026D38; Mon, 6 Feb 2023 15:08:33 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 7A104A807DB; Mon, 6 Feb 2023 16:08:32 +0100 (CET) Date: Mon, 6 Feb 2023 16:08:32 +0100 From: Corinna Vinschen To: Bruno Haible , bug-gnulib@gnu.org Subject: Re: [PATCH] Do not decorate symbols as dllexport on Cygwin Message-ID: References: <20230205194344.269174-1-vinschen@redhat.com> <2995619.l0kZKy6ypc@nimes> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.129.124; envelope-from=vinschen@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Hi Bruno, On Feb 5 22:22, Corinna Vinschen wrote: > On Feb 5 21:41, Bruno Haible wrote: > > Another option — since we are talking about a single symbol and a single > > platform — would be if the locking for setlocale_null were not necessary > > on Cygwin in the first place. I determined that it is necessary by running > > the unit test gnulib/tests/test-setlocale_null-mt-all.c [3] on Cygwin: > > without the lock, it crashed within less than 1 second. Could the > > implementation of setlocale() in Cygwin be changed in such a way that this > > test does not crash? Then the lock would be necessary. > > Well, we could do that by adding Cygwin-internal locking to setlocale > calls. But that would only be available in the next Cygwin version > of course. > > May I ask what's the idea to provide a thread-safe setlocale? It was > never defined as thread-safe and POSIX explicitely mentions that. Any > application expecting to call setlocale thread-safe is broken by design. > It should use the newlocale/duplocale/uselocale/freelocale API instead, > isn't it? Ahhh, I finally see what's going on. The problem is not thread-safety as such, but thread-safety when reading the value of the LC_ALL category. Glibc's setlocale isn't entirely thread-safe either, but there's a difference: - GLibc creates the global strings returned by setlocale(LC_xxx, NULL) at the time the locale data is changed. All setlocale(LC_xxx, NULL) calls only return pointer to strings created earlier. - Cygwin or, better, newlib, also return a pointer to global strings. However, while the global strings for the specific categories are created when the locale is changed, the string returned for LC_ALL gets created on the fly when setlocale(LC_ALL, NULL) is called. That's why test-setlocale_null-mt-all fails almost immediately. I created a patch to newlib's setlocale to tweak the LC_ALL string each time the locale is changed, while setlocale(LC_ALL, NULL) just returns the already prepared string. https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=23e49b18ce39 This patch will be in the next Cygwin release 3.4.6. I'm just a bit fuzzy what patches will be required for gnulib now... Thanks, Corinna