From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112379 invoked by alias); 1 Apr 2019 22:08:56 -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 112275 invoked by uid 89); 1 Apr 2019 22:08:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-0.2 required=5.0 tests=AWL,BAYES_50,BODY_8BITS,GARBLED_BODY,KAM_SHORT,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 spammy=HX-Languages-Length:1833, =d0=b2=d1, H*f:sk:CAL5iTP, H*f:sk:K_aE4fk?= X-HELO: rgout01.bt.lon5.cpcloud.co.uk Received: from rgout0107.bt.lon5.cpcloud.co.uk (HELO rgout01.bt.lon5.cpcloud.co.uk) (65.20.0.127) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Apr 2019 22:08:53 +0000 X-OWM-Source-IP: 31.51.207.0 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-SNCR-VADESECURE: CLEAN Received: from [192.168.1.102] (31.51.207.0) by rgout01.bt.lon5.cpcloud.co.uk (9.0.019.26-1) (authenticated as jonturney@btinternet.com) id 5B321EA019E91547; Mon, 1 Apr 2019 23:08:50 +0100 Subject: Re: [PATCH][PR server/24377] Fix mixing English and system default languages in error messages on Windows To: =?UTF-8?B?0JLQu9Cw0LTQuNC80LjRgCDQnNCw0YDRgtGM0Y/QvdC+0LI=?= , gdb-patches@sourceware.org References: <83mullpwg6.fsf@gnu.org> <83ef6qjdbb.fsf@gnu.org> <838swyjafd.fsf@gnu.org> <837echkgjo.fsf@gnu.org> <8336n3hzkx.fsf@gnu.org> From: Jon Turney Message-ID: <7041169d-9f64-fcce-2c3c-021dd1858923@dronecode.org.uk> Date: Mon, 01 Apr 2019 22:08:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2019-04/txt/msg00007.txt.bz2 On 31/03/2019 20:39, Владимир Мартьянов wrote: > вс, 31 мар. 2019 г. в 17:45, Eli Zaretskii : > >> Bother: do we want to behave like a Posix platform here, or like a >> Windows system? Windows doesn't have LC_MESSAGES as a locale >> category. > > I just saw LC_MESSAGES usage in gettext... Having LC_MESSAGES be controlling is definitely correct for Cygwin. I'm not sure about a MinGW build of gdb. >> Finally, a more general point: I'm not sure I understand the purpose >> of this change. Is the purpose to let users control the language of >> the gdbserver system error messages? > > Yes, it's the purprose. I'm wondering why this problem doesn't crop up in gdb itself? Are there no uses of FormatMessage() in that? >> If so, would they need to >> control that by setting environment variables? It sounds less >> convenient than it could have been, I think. Why not a GDB variable >> instead? > > Environment variables are used in gettext anyway, I think single > source for localisation language is convenient. > > I corrected issues you mentioned (I hope!) and made a function to get locale ID. A few comments on your get_lcid() function: - It looks like this is going to ignore LC_ALL etc. if LocaleNameToLCID and Rfc1766ToLcidW can't found. This doesn't seem correct as the environment variable should still have an effect. - You're not checking all the environment variables which might control the locale for the message locale category (See e.g. [1]). I don't think there's any need to do this by hand, since you should be able to use the result of setlocale(LC_MESSAGE, NULL)? [1] https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html