From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9230 invoked by alias); 12 Jun 2014 18:35:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 9218 invoked by uid 89); 12 Jun 2014 18:35:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout27.012.net.il Received: from mtaout27.012.net.il (HELO mtaout27.012.net.il) (80.179.55.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jun 2014 18:35:06 +0000 Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0N7200L00IZE5500@mtaout27.012.net.il> for gdb-patches@sourceware.org; Thu, 12 Jun 2014 21:32:01 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N7200FQ0JHD7L80@mtaout27.012.net.il>; Thu, 12 Jun 2014 21:32:01 +0300 (IDT) Date: Thu, 12 Jun 2014 18:35:00 -0000 From: Eli Zaretskii Subject: Re: [ping] [PATCH] Different outputs affected by locale In-reply-to: <5399EC00.4000601@redhat.com> To: Pedro Alves Cc: yao@codesourcery.com, tromey@redhat.com, brobecker@adacore.com, gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83egyux9h2.fsf@gnu.org> References: <1401192650-29688-1-git-send-email-yao@codesourcery.com> <538EAEE5.2080708@codesourcery.com> <20140604124708.GR4289@adacore.com> <538F1CC3.9090605@codesourcery.com> <87oay8a0t6.fsf@fleche.redhat.com> <538F803A.9020007@redhat.com> <538FE412.1050806@codesourcery.com> <53903119.6000204@redhat.com> <53903EE5.8090107@codesourcery.com> <539042A2.4050409@redhat.com> <539571C6.40605@codesourcery.com> <53958862.5020106@redhat.com> <5397BCEC.8080300@codesourcery.com> <539990BD.9020504@redhat.com> <83tx7qxdg6.fsf@gnu.org> <5399E2D7.3060705@redhat.com> <83ioo6xbk2.fsf@gnu.org> <5399EC00.4000601@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00522.txt.bz2 > Date: Thu, 12 Jun 2014 19:05:52 +0100 > From: Pedro Alves > CC: yao@codesourcery.com, tromey@redhat.com, brobecker@adacore.com, > gdb-patches@sourceware.org > > Trying again then. Thanks. > The testsuite framework does, in gdb.exp:gdb_init: > > # We set LC_ALL, LC_CTYPE, and LANG to C so that we get the same > # messages as expected. > setenv LC_ALL C > setenv LC_CTYPE C > setenv LANG C > > ... so that output is stable for everyone. With you so far. But note that on Windows, even the above does not guarantee "stable output", because the console codepage is not changed by 'setlocale', and moreover, the Windows 'setlocale' doesn't pay attention to environment variables. So on Windows, these tests run in the default system locale (because we call 'setlocale' with the 2nd argument an empty string). > And if we do that, we miss making sure GDB works correctly > with locales/charsets other than C/ASCII on most hosts. And here, "works correctly" means what? sets host-charset? or something else? Assuming the former below. > So I was just saying that IMO ideally we'd have tests that > make sure GDB prints what we think it should print when > LC_CTYPE (etc.) is set to something else, like e.g., > en_US.UTF-8. You cannot ask the Windows 'setlocale' to use UTF-8 as the codeset (although there is a UTF-8 codepage, and Windows does support it in general). More importantly, since 'setlocale' on Windows disregards the environment variables, you cannot change the host charset by setting environment variables. You must do that by a GDB command that sets host-charset.