From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from butterfly.birch.relay.mailchannels.net (butterfly.birch.relay.mailchannels.net [23.83.209.27]) by sourceware.org (Postfix) with ESMTPS id A7333385AC24 for ; Mon, 19 Jul 2021 08:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7333385AC24 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 90270361DC6; Mon, 19 Jul 2021 08:35:07 +0000 (UTC) Received: from pdx1-sub0-mail-a58.g.dreamhost.com (100-98-55-150.trex-nlb.outbound.svc.cluster.local [100.98.55.150]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 16D3D36168F; Mon, 19 Jul 2021 08:35:07 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a58.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.98.55.150 (trex/6.3.3); Mon, 19 Jul 2021 08:35:07 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Harmony-Cooperative: 351673aa5e4da47f_1626683707411_1210230010 X-MC-Loop-Signature: 1626683707411:2108898523 X-MC-Ingress-Time: 1626683707411 Received: from pdx1-sub0-mail-a58.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a58.g.dreamhost.com (Postfix) with ESMTP id BC1A08AECF; Mon, 19 Jul 2021 01:35:06 -0700 (PDT) Received: from [192.168.1.141] (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a58.g.dreamhost.com (Postfix) with ESMTPSA id B702C8AECC; Mon, 19 Jul 2021 01:35:03 -0700 (PDT) Subject: Re: [PATCH] setlocale: Fail if iconv module for charset is not present [BZ #27996] To: Carlos O'Donell , libc-alpha@sourceware.org Cc: fweimer@redhat.com References: <20210630085642.2661589-1-siddhesh@sourceware.org> <15d97714-1294-5373-770f-b285f985a7b1@redhat.com> X-DH-BACKEND: pdx1-sub0-mail-a58 From: Siddhesh Poyarekar Message-ID: <2e328221-075c-0297-d437-a1515373dd92@sourceware.org> Date: Mon, 19 Jul 2021 14:04:58 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <15d97714-1294-5373-770f-b285f985a7b1@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3486.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2021 08:35:11 -0000 On 7/17/21 1:58 AM, Carlos O'Donell wrote: >> + >> + struct gconv_module *root = __gconv_modules_db; >> + >> + while (root != NULL) >> + { >> + int cmpres; >> + >> + cmpres = strcmp (name, root->from_string); > > I think this is incomplete. > > (a) We must have a converter that goes from name->INTERNAL. > (b) We must have a converter that goes from INTERNAL->name. > > You are only checking for (a) here, which means we can read > input of the charset, but we can't write it out via printf > and I don't think that would match user expectations. Hmm, I had assumed that the presence of name->INTERNAL implies the presence of INTERNAL->name. If we had to be properly general purpose then the check ought to confirm that we can actually find a transformation from name->INTERNAL and back: =========== if (__gconv_find_transform ("INTERNAL", name, &steps, &nsteps, 0) != __GCONV_OK) return false; __gconv_close_transform (steps, nsteps); if (__gconv_find_transform (name, "INTERNAL", &steps, &nsteps, 0) != __GCONV_OK) return false; __gconv_close_transform (steps, nsteps); return true; =========== Does that sound right? Siddhesh