From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2.pdinc.us (mail2.pdinc.us [67.90.184.28]) by sourceware.org (Postfix) with ESMTPS id 810D63835821 for ; Mon, 17 May 2021 14:11:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 810D63835821 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=pdinc.us Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jpyeron@pdinc.us Received: from lovegrove (nsa1.pdinc.us [67.90.184.2]) (authenticated bits=0) by mail2.pdinc.us (8.14.4/8.14.4) with ESMTP id 14HEBEKU008944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 17 May 2021 10:11:15 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 mail2.pdinc.us 14HEBEKU008944 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pdinc.us; s=default; t=1621260675; bh=2Wy098yppf7lCbbG0KUGMUrf4yxveilY+tY+TMCHG4Q=; h=From:To:Subject:Date:From; b=ivhgUWFZvE6hViDXuLk+0CPvvO3YknXdjQiq4g9cLr1y+7SJs5eDqzgoEm2r0Gns5 zPJyj4F9eCcPvKMobnTBOZBzF9n0AzMY5vD0mMRItV5pTvZYJV9r7E+msFQ/p4mwaa bgDJm28N/wIqcmDkpXytq0myaatsUL4wtO9nDobYBn9N0D+Kp+FDMhEYGzqQcVJhZR ml43IW3N/Mafx1WQe+3rS3Q32IkoSDWCG/4ORJe7MAfuM8AGj3g1LcAe0V2QcCDH1H FR+RZvVz86vTnQXgYIQyZfxrtkfFGt7rclwbvMvoyFGKzTjYqw/DtuQM8A1xgsktPE q1b4RHzt5VhbQ== From: "Jason Pyeron" To: Subject: locale bug? Date: Mon, 17 May 2021 10:11:25 -0400 Message-ID: <062101d74b26$85d13600$9173a200$@pdinc.us> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 15.0 Thread-Index: AddLJoVf+mAnMNzPQ12/4ZINMrSd2g== Content-Language: en-us X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, KAM_INFOUSMEBIZ, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 14:11:25 -0000 While working an updated build of pdfgrep, I ran in to a crash when the = environment local was something other than LC_ALL=3DC. =20 Looking at http://www.cplusplus.com/reference/locale/locale/locale/ the = empty string passed to the constructor should use the environment's = default locale and if the =E2=80=9Cargument=E2=80=9D does not represent = a valid C-locale in the implementation, runtime_error is thrown. =20 =20 $ g++ -o bug50 bug50.cc ; echo en_US.UTF-8; LC_ALL=3D"en_US.UTF-8" = ./bug50; echo C; LC_ALL=3DC ./bug50 en_US.UTF-8 Line:8:start Line:17:exception thrown Line:19:succeeded using Minimal C locale (the same as locale::classic) Line:21:about to set global locale Line:23:done C Line:8:start Line:13:succeeded using The environment's default locale Line:21:about to set global locale Line:23:done =20 $ cat -n bug50.cc 1 #include 2 #include 3 4 using namespace std; 5 6 int main(int argc, char** argv) 7 { 8 cout << "Line:" << __LINE__ << ":start" << endl; 9 locale l; 10 try 11 { 12 l=3Dlocale(""); 13 cout << "Line:" << __LINE__ << ":succeeded using = The environment's default locale" << endl; 14 } 15 catch (exception& e) 16 { 17 cout << "Line:" << __LINE__ << ":exception = thrown" << endl; 18 l=3Dlocale("C"); 19 cout << "Line:" << __LINE__ << ":succeeded using = Minimal C locale (the same as locale::classic)" << endl; 20 } 21 cout << "Line:" << __LINE__ << ":about to set global = locale" << endl; 22 locale::global(l); 23 cout << "Line:" << __LINE__ << ":done" << endl; 24 25 } =20 Thoughts? This is out of my knowledge area =E2=80=93 never worked with = locales in C++ before.