From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E45811F47C for ; Fri, 13 Jan 2023 23:37:05 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=cs.ucla.edu header.i=@cs.ucla.edu header.a=rsa-sha256 header.s=78364E5A-2AF3-11ED-87FA-8298ECA2D365 header.b=XKw8bIKg; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGTbZ-0000xe-8L; Fri, 13 Jan 2023 18:37:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGTbY-0000xT-9Y for bug-gnulib@gnu.org; Fri, 13 Jan 2023 18:37:00 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGTbW-00038G-8Z for bug-gnulib@gnu.org; Fri, 13 Jan 2023 18:37:00 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9781816007E; Fri, 13 Jan 2023 15:36:56 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DGDuTIsJjKhR; Fri, 13 Jan 2023 15:36:55 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B2035160081; Fri, 13 Jan 2023 15:36:55 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.9.2 zimbra.cs.ucla.edu B2035160081 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=78364E5A-2AF3-11ED-87FA-8298ECA2D365; t=1673653015; bh=mmrrq8KtVgbrJBcJSl2fydNKimGeWvohSbprvTszrsU=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type: Content-Transfer-Encoding; b=XKw8bIKgZnp56DfZMYSYIl9Pg0y2o/yocUInI3vQpKV2b2cSNQB+zp+7+fP0xVVTZ 7DvnaIjnVEV0ixntWvehxFlI86U1QS6xrEKgHIPR3mtmSin4ExAJetBaW3Mfyy2wOK t3en6TKEVkGaZdX3agJa9DRRQN11JKeG8+tsygAU= X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IaKULNq73S2v; Fri, 13 Jan 2023 15:36:55 -0800 (PST) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8BF3716007E; Fri, 13 Jan 2023 15:36:55 -0800 (PST) Message-ID: Date: Fri, 13 Jan 2023 15:36:55 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US To: Bruno Haible , bug-gnulib@gnu.org References: <20230113201704.325290-1-eggert@cs.ucla.edu> <17910367.MNNF8PUAaN@nimes> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [PATCH 1/4] localename: -Wtautological-pointer-compare In-Reply-To: <17910367.MNNF8PUAaN@nimes> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org On 2023-01-13 14:59, Bruno Haible wrote: > Replacing a function that starts with an entry check =E2=80=94 which is= a good > practice [1] It's a good practice in some contexts, bad in others. In this particular case, on practical Gnulib targets the input should be=20 checked anyway, both statically by the compiler at the call point and=20 dynamically by the MMU. There is a downside of the extra runtime check, in that if static=20 checking is disabled (a mistake if you ask me, but many people do it),=20 then the calling code won't immediately crash like it should. Instead,=20 the function simply sets errno and returns, and the calling code might=20 go on to do the wrong thing because there's a lot of sloppy calling code=20 that either doesn't check errno or that has never been tested to do the=20 right thing when the function fails. So my guess is that for this particular case on practical hosts, the=20 additional runtime check is more likely to introduce a security bug,=20 than to prevent one. Of course this is just a guess. But that's why I=20 wrote the patch the way I did.