From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id E46C13858010 for ; Fri, 5 Nov 2021 13:01:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E46C13858010 Received: by mail-oi1-x229.google.com with SMTP id g125so14404581oif.9 for ; Fri, 05 Nov 2021 06:01:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=aq+PRYyj22Az5Bft+jgHATz8VteyCMnaIasNN55Hnys=; b=IMl4ZAPu2YpCLt/LjoyLpKi6yMzjS70NGOhd0DdG54shil5WaA228dh2SP5E7xzqoj V05EhwZE4XNHiQcjApyn0ZVSafRMxVJLWqb4ORAwtJYwRkpH/jQLM0yYmEZC6+XGCYhn iIgnQDVIP1pduW4+Fb7nmED8gTE29nU2R472nAHON3gI1pZHCN6u7E/g0uvKN6xNXqWV hdOSUN1vg76RTQpNWRrvedXVuifUdjlEECqnynW1kdPR7ZFz2xJ0AbSmqPQKGjQHyKgG GgYIgR0nPQjLPnJI50y4hBizT0im01nFMVhuRQejm5ShQzHwIRVYapB+IbeLP4gjvKpG 1gdQ== X-Gm-Message-State: AOAM530BpVmpmy+tB/aryh07fXI5Jifs+pufi78OR/HmHBfb1+nIEHgj GaT8r5ORmgwGZKXoxEIjeCHhcHMeufWsBA== X-Google-Smtp-Source: ABdhPJwKJz+lDqeFAIYtiVZomXlPGJogWGmCMUc256LT/ztM4XihbOeVpZyF0dBaZ6AIHLMe7iX1uQ== X-Received: by 2002:a54:4e97:: with SMTP id c23mr21409082oiy.153.1636117285781; Fri, 05 Nov 2021 06:01:25 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:55a:c916:e574:3d13:f60c? ([2804:431:c7cb:55a:c916:e574:3d13:f60c]) by smtp.gmail.com with ESMTPSA id j7sm2227531oon.13.2021.11.05.06.01.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Nov 2021 06:01:25 -0700 (PDT) Message-ID: <66a2e472-d4e2-96bb-d1a5-8bafa795083f@linaro.org> Date: Fri, 5 Nov 2021 10:01:23 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: glibc strerrorname_np Content-Language: en-US To: Jonny Grant , libc-alpha@sourceware.org References: <98556e3e-2869-64f0-574e-7a64503185c2@linaro.org> <9613b21a-3ab0-3303-9321-7bf4e36ce7ed@jguk.org> <77e058e8-2f54-46a5-2180-9784f23040e7@linaro.org> <4f5422c1-d6ea-1ea5-eeea-db61f8b95bc8@jguk.org> From: Adhemerval Zanella In-Reply-To: <4f5422c1-d6ea-1ea5-eeea-db61f8b95bc8@jguk.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Fri, 05 Nov 2021 13:01:33 -0000 On 05/11/2021 08:51, Jonny Grant wrote: >> > > Hi Adhemerval > > Thank you for your reply. Personally I understood an ABI break would be the return type, the name, or the parameters. But the proposed change is not so. Changing to return a string, should be fine. It is still an ABI break, code that checks NULL for invalid input will stop to work. > > ie, in relation to strerror() C99 and POSIX.1-2008 require the return value to be non-NULL. (my view is it is always better not to return a NULL from such string functions that could then cause a SEGV. > > strerror(1000) returns a string "Unknown error 1000" > > Better to simply align with glibc strerror() approach? > > Feels like there is still time to change it, as it is _np. Aligning with strerror(), or just "" as you had mentioned seems reasonable. I give you that it is indeed a better return code, and it is not a matter of timing, but rather I don't think it really worth the ABI break and the required code complexity to do so. It would require: 1. Change the strerrorname_np to return "" on invalid code. 2. Keep the compat symbol that returns NULL and add a compat symbol. 3. Exports a new symbol with version on 2.35 with the new semantic and update the ailist. 4. Update the documentation and sync with man-pages. > > > https://man7.org/linux/man-pages/man3/strerror.3.html > > It's common for some returns to change, eg glibc 2.13 changed strerror_r() behaviour to return the actual error code, as opposed to returning -1 and setting errno. And such change did got without burden and extra complexity. Just check the multiple preprocessor checks it requires to get the right definition depending of the system support on the misc/error.c (imported from gnulib).