From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12D61548F7 for ; Thu, 18 Jul 2024 21:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=85.215.255.54 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721337708; cv=pass; b=mkm3lrSHiKpjseYv1Lczl46AXDXt8DkWqQj9zHmN4TGHKPUJqJazK4s+2rqqXMOJfEM3QnljRttaTx1CDNXOYPsYudSfuTyRgm5i0K/HQZ5Go94y8qWC77gcUUbfbsPKHIGoI/emIFray8MHSGdoBFdXPHeeKMK3FyPKOsjzgcs= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721337708; c=relaxed/simple; bh=kaU4XEHDYeoyLQxXn2xYSVhsPgnK8OJR0YxUY/h2pys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=M2VnfFAil8oEia4UQ6Co+xEa6sJ+yvq7POmJ1PM6cUQnW7kvgLNg8e2Nd2fL3EpzB5ZKTnB2gbWQDz+gP73T73gumJuBUK0/HXRVmvmELzUb1O4xGy+8ADj5uR9be8N0/zh5EWnqH2RcDwvu1UH3DwBzY5laVHEp4EHuEXeNVqk= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=clisp.org; spf=none smtp.mailfrom=clisp.org; dkim=pass (2048-bit key) header.d=clisp.org header.i=@clisp.org header.b=jxijJEOJ; dkim=permerror (0-bit key) header.d=clisp.org header.i=@clisp.org header.b=F3EJbabD; arc=pass smtp.client-ip=85.215.255.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=clisp.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=clisp.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=clisp.org header.i=@clisp.org header.b="jxijJEOJ"; dkim=permerror (0-bit key) header.d=clisp.org header.i=@clisp.org header.b="F3EJbabD" ARC-Seal: i=1; a=rsa-sha256; t=1721336981; cv=none; d=strato.com; s=strato-dkim-0002; b=Co1PqpJgf+vFaeXoeSpSDPPy0btQq1o6tgkWmNBEH3G8qRu+GNIhGPiy16kdYTu6kf ZAS4GXKHLknvDd5veE8LZ/IlyfBVpsCcIDA4D1t1mwOWj3ITvzAMw6YbERfR10LsAj6I fzHyINMPwFAZ3RdhS5P9uZlmo0P2NEO8MTEAPkXGsRQDJWTamySKCeUjZX0/EbtMEYfe Ux/8Psp68rBpdzwROO7kWOvKjbqFsAtEeiMeKhyGnlXEhDB2skn3fji8c+XNt9L7qQiO C4Pg2wHplbQIVBb133Zqe0LKKjHobee5h3tR/6JnRnVr+aDWEpfxj7hHD0z5ox4prIs5 H3VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1721336981; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=jci2lfAVHfoELe0Y+5BJzNaHMugoN1qJ4vY8ybIf2Ug=; b=WvYkDLDuGEnOo7uD+3PB2vlXO7OaflhRjhUfkaVoIlgHuLDBHc530HkCLpEObmMtpU N1uxZUdmoQ96oYf+Ae1txrzlDNE9lL35mCX6AGq8TT2IO3IV6uWbvZ/0DE+n7kcPrRHd MVV+a7/HXPfXSp6UJrTkyS7LNkm5sX06+bryJwKNRVGGo0i+CpAGkzrMA9DwEJ/OwQ4x B8rE2WFtnJv6LMFqObQZnV59A4HlPehSPMcyt8gYvBhvocO91FFWaCIfBkC9rZux8eSt pRw9r4L5Cb9I4f4wdmbse+mCvuny0STu4RrmZRE8wyMLh8VXI1DvAmKMOSZSLMgQ9wQB Ybfg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1721336981; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=jci2lfAVHfoELe0Y+5BJzNaHMugoN1qJ4vY8ybIf2Ug=; b=jxijJEOJJa48VeZcYpXe5pVqGEYmEYltB3P4JoWbI6YJ74GS0sWhQ6IqFbpls3Y2SX 1k+h2V7NfKYfdljdk81XCYzMBqY/bCRUa8bQdy00J52dTTkT5nIyHU+iJU7InIKrJwdt SD+nKyLhiSlLnEkONOtQlZO3i7hcCbu6HYTr+CCSi1xurV44CUzMbAr9fGDfURKPXADh rbgvnC5ROLIjEwSzIZ05HEukRJ2khRV59AVTnlSBBhCGfgs7RCXBepUwx34EDa1uV1jq 488mFFfS2Ydj0rBwo6596lvhV5Fc+xSI9Z/R30+AtFTU4FJJRm/bLGsSVt9ALpvG2a1Y 1SUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1721336981; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=jci2lfAVHfoELe0Y+5BJzNaHMugoN1qJ4vY8ybIf2Ug=; b=F3EJbabDX/oEMTcluURrmXKsdtD7QsC5T1agLnc2RfrbU/ixlORhQvGGtvtRB0F5pu 9n4NbiFQsPZtp1WWXoCw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPCjqFxtlDfTi9pddt8LZVl8os5yg==" Received: from nimes.localnet by smtp.strato.de (RZmta 50.5.0 AUTH) with ESMTPSA id N0957e06IL9fDiJ (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 18 Jul 2024 23:09:41 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org, Alejandro Colomar Cc: Paul Eggert , =?utf-8?B?xJBvw6BuIFRy4bqnbiBDw7RuZw==?= Danh , Eli Schwartz , Sam James , Serge Hallyn , Iker Pedrosa , "Andrew J. Hesford" , Michael Vetter , liba2i@lists.linux.dev Subject: Re: [PATCH v1] xstrtol: Remove dead code Date: Thu, 18 Jul 2024 23:09:40 +0200 Message-ID: <8009158.qOBuL9xsDt@nimes> In-Reply-To: <20240718203147.47143-2-alx@kernel.org> References: <20240718203147.47143-2-alx@kernel.org> Precedence: bulk X-Mailing-List: liba2i@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi Alejandro, > strtol(3) has a limited set of possible states: > ... > The condition '*endp != s && errno != 0 && errno != ERANGE' is > unreachable. The only errno possible if '*endp != s' is ERANGE. Such a statement can be true if you look at the standards (ISO C, POSIX). However, there's a difference between what the standards say and what the systems actually do. The Gnulib documentation contains thousands of examples of such differences. Gnulib therefore (almost) never assumes that there are no possible errno values besides the ones listed in the standards. - Some systems return "wrong" errno values. Example: [1] - Some systems fail with ENOMEM when memory is tight. Who says that an implementation of strtol() cannot use malloc() ? Some implementations of strtod() do use malloc(). So, what you call "dead code", I call "defensive programming". I would not like to apply this patch. Bruno [1] https://www.gnu.org/software/gnulib/manual/html_node/getlogin_005fr.html