From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: file-equal-p Date: Thu, 16 Feb 2023 17:58:29 +0800 Message-ID: <878rgyq6d6.fsf@yahoo.com> References: <87a61es8fh.fsf.ref@yahoo.com> <87a61es8fh.fsf@yahoo.com> <83fsb681me.fsf@gnu.org> <87pmaaq9ua.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31263"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 16 11:01:39 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSb58-0007yO-DH for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Feb 2023 11:01:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSb4W-0004Xo-MZ; Thu, 16 Feb 2023 05:01:00 -0500 Original-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 1pSb4T-0004Xd-Vw for emacs-devel@gnu.org; Thu, 16 Feb 2023 05:00:58 -0500 Original-Received: from sonic307-35.consmr.mail.ne1.yahoo.com ([66.163.190.58]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSb4R-0000Hq-LM for emacs-devel@gnu.org; Thu, 16 Feb 2023 05:00:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1676541652; bh=ZOJ49QQrNnYHGcn37kIqyr8RcNBU4M1G+PblVKUqCgk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=O8Psk2jEvpeMu+ErbPLZsm9ZS9wVfwCZ2YVN3trAIdiEzRmcZnjliKYqQ9sNSdn1OFsnbisWFkEsL3tueZE9mypj3ZVzmGk9F5n/MkArfGY/GhaWJFt1n2e1hmxiLsgEeu0l7wKeL23yQ+2qQefb/AIs94NOROeew/5QkADY04pyHTmIdB7HOuWjOx8YZd4qb+iqlq8hpQRsv62GYDFUshwe64x3JKVnPovwWzv42P5z1nACoBAsQRsmRdFtLvI3wB1ob140tkfFlYvpxLJrB1CfZLP1daB/Z6b6QqYsG2H4UyWLNyYJY8RH0tatL4+GBtUPK5x1BBZO3oVGSXldbw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1676541652; bh=PN2uQuqa5dlWnAufhyA4jIYPwyQbLLGKMIE3rQ3E/+K=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=qss9A3QlRewxC7bH7GWiX1ND5Dabm1L99t4+f+3A95dyAEHIvqmwe6DwZC246sWXYsJcb0yogS4JcOzWvyIlO3KAM4xivlcw3sc4FwWNf4KYNmkPV7TqPbLNXIRoir41MJXHncXIJfagVM1DV3tcbql5naqIpA8NRkLO2uEmhOERrtQZbKCYgwROTXoww+EjNQgDWLhBKIu3Ty2rQuPYMwB7cGKAXMADDvIwYIjUwsazycI8jQPeGUAbIArI76rAdq/be+XyCsdQs86q9ecasuqPVZ4fKYKljG6XkQS+M49W+aQLorhl9DQm0eU+8nPSEJ53yQksmOoAaIorPHDsOA== X-YMail-OSG: R2_H3LUVM1kBaY9LYW5q1Lv1uFnWykMUPC1fN1GAPjlkOidscCVqXno6DSjTObE UAVOfVR97fwIPh2pt3dhIw5kSMQlOqCAyUjglRfSz3LMOtQBFIFK39k7bfW4Dnj2ocwEpOnMLSgT kCPHEsdB1iAn_O2Kwazxgtq7jINFMLD9DB5GJFkwXfZY0a6rJmW5wPoRFHpmd7GJslsN_TUjabHx HYofZUvLrgdYKW4CpYJfbEDJVqc7kejcSNOpHl5VBiqkLcoJzTN0v02V4Rt_KL0F24JYxlEf.YpV 2rKztO8Yx9KcsPfg2lTtVR4oW.RmNarSwdUNcNI4IVgW5rpRZs1ZKck5JH7mNIbE9FVYSI9aQ55A XtBW9Ch3OQZTg2s6FRcCHRw4NXoSOX9yXwag3RR5MtCJtW31kFCQxjqHr.WV6b7pGsSZYFgnFxyS LkYoJVkDMyIDzp4MH8F.JeMQWHJGbcand8YOYHqwYsUVqXI3qC3VtvN5b6jzzYj9qZOTeI0V8LVk 8wW0Bya3be_pcb8M_vQW_vy7asKL2sJ_e8HbfvMzFdqDGwUn9bgD.4.qCMcB7cxOsXzzcm10USuZ fNS_XgGf0NxpM.Kx7s5Q9TMiMINl8EfbEfW5dD_clPM_ck2ZhWMotc1szT6LgfWiKnb9Z1Xj5P7i WfWOR0XeiWytiudJVcZk3i8GJv0K9fKI8EbuKQ1hsosMFa2yfh1uZn7c2wskepIJZ8S4NrHaU5je mDoeHMIaB2VyYUSxXwNoZhFCcQz3ogfK4GD48banZjz6ciJFYRDFr75tAwenxjaMW1onfiXK6TQc 16DJoVqholtrqd6ZUNYGg9shCbMMZgwE6ot6EeDLKF X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ne1.yahoo.com with HTTP; Thu, 16 Feb 2023 10:00:52 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-r2vxw (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 431b276b5016328cba8f966b6ad6f269; Thu, 16 Feb 2023 09:58:49 +0000 (UTC) In-Reply-To: (Andreas Schwab's message of "Thu, 16 Feb 2023 10:15:07 +0100") X-Mailer: WebService/1.1.21183 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.190.58; envelope-from=luangruo@yahoo.com; helo=sonic307-35.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303392 Archived-At: Andreas Schwab writes: > On Feb 16 2023, Po Lu wrote: > >> diff --git a/lisp/files.el b/lisp/files.el >> index b0ec6bb09d0..dcd17df166a 100644 >> --- a/lisp/files.el >> +++ b/lisp/files.el >> @@ -6360,7 +6360,17 @@ file-equal-p >> (let (f1-attr f2-attr) >> (and (setq f1-attr (file-attributes (file-truename file1))) >> (setq f2-attr (file-attributes (file-truename file2))) >> - (equal f1-attr f2-attr)))))) >> + (progn >> + ;; Haiku systems change the file's last access timestamp >> + ;; every time `stat' is called. Make sure to not compare >> + ;; the timestamps in that case. >> + (when (and (eq system-type 'haiku) >> + (consp (nthcdr 4 f1-attr)) >> + (consp (nthcdr 4 f2-attr))) >> + (ignore-errors >> + (setcar (nthcdr 4 f1-attr) nil) >> + (setcar (nthcdr 4 f2-attr) nil))) >> + (equal f1-attr f2-attr))))))) > > Why does that compare more than the inode and device number? The other > attributes can change any time, if another process accesses the file or > modifies the inode between the two calls of file-attribute. That's what I thought too, but it's not a good thing to doubt code that has existed for a long time.