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 20:35:13 +0800 Message-ID: <87lekxpz3y.fsf@yahoo.com> References: <87a61es8fh.fsf.ref@yahoo.com> <87a61es8fh.fsf@yahoo.com> <83fsb681me.fsf@gnu.org> <87pmaaq9ua.fsf@yahoo.com> <87ilg199tt.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32340"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Andreas Schwab , Eli Zaretskii , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 16 13:38:02 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 1pSdWT-0008Bm-Bi for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Feb 2023 13:38:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSdWB-0000DD-8b; Thu, 16 Feb 2023 07:37:43 -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 1pSdW9-0000Cy-Rp for emacs-devel@gnu.org; Thu, 16 Feb 2023 07:37:41 -0500 Original-Received: from sonic313-35.consmr.mail.ne1.yahoo.com ([66.163.185.58]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSdW8-00063r-Ci for emacs-devel@gnu.org; Thu, 16 Feb 2023 07:37:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1676551057; bh=yh7SBcypGBrI67/VzQP08rxPtan9m0uvk1+VRGImkJ4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=d+fk6Ub8bK1uTExZwYAaWOH3SrT6w/avH3B/cRNkssstENCdaqazqCA05BLr3dWqie5HlcvIRgtThwBZj4eh1X37qljuqwfm5HglolMgxh2dNTATYoxSwaytUedWB5nf/XyHo4M1ds8eHxOQBECykGpNY6keS879trrs+ANQ4khfjdUEn4DjydZChMjWoxEWHj1xPBzVpS/2FsOvhyA7+UhMlnyWQ84+oXH8FPvzYc2+9yIoypf8VDhO7ZR3MF1iqftZKOT+eb/M0rCxeJbfLj+rYpiVHPhHF0Bs/btXqUMyrUnZHQH2bh3CPVrM6tub70YVYyC9pLvemZxX2kgVog== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1676551057; bh=Qt1lYsLky00ObxljTirx0cC0l18O0DOjzOnuR4f6LOl=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=V5CDfgm+aR8hELBdTiHwTxWXt2vbUqtqZcFMtkLzfmv9MTUxm0rTaC1OBvzac25pCHtCKbNqNFaNNy7T+jvc+RwTUkXxWe+8n5HqmGHmhD4G0lmgX8E1QhwFAELkZ9l7A6zGNWw12e7G8Sghb052/JneX6Bolh/gg02ACoGRLQPNms2FysKMTqga6AYJBhpob4KeUdQlXlDx5x+e/sbGH1tPx4cOaev49Zy4ok8t5zJo74muCEyqaZveLybyrRxxipwjoWSD97TudbJqEwcE03DnZHMFSVZViMo96FgC4RMOdff31hEwELKeRTMsJhnwHy0gVF1EIQbaU77x+5/l/A== X-YMail-OSG: vJW_4sgVM1lqcLr5O5jlZ4sYEZkzK3GKCf3Prlvs.YddXaDrqN.G47TxuWYDFGA EYbYEIWLs1gRPRy2qOom6prUV5NqVq2qySzG87znliyYBj0coTfW4vjgcH85mirnWqUnBDsv1IBe 1scuF1_76ZXEAnfD.cg5CXtvDLa1F1k93P2Xo7srjJta.yeONzKWfsw208Az9i6.waavLo42AfST dSZ5WCqZoCCPAC9HBUy7lFwYz45SdOK5ifs3FKQ3xrKGxo0Km10KViJjLjpnfCC_Vq8V4xW_SrYN 4ta3jlXvRMAlktndJJCno2EXlaOadT9BX5D3ae1IIrSk.gZ49fyhqIrLrdjpTcYWvX1REfkhDSuF qhmvLUBP5mE0lXco.Ug4XySBsA90bhTB0OvX8GrFus9f3E.km.mlZgQhWguwBKUSM2c.9hwpofXN Gs29Hi7FM4.P4CZubHPiJnakR40yBD_ta6ogKtagQMwpGrH.u25ypZRVJ8zpodhAN0FpNjBVfqrC lleDpN8FpO8XvD39Hf02zqm3Q1zDL3TIiZphz8uBICwJtjjoeqDpouJMU19EpVEFbQJm5Pb6podp cZzeEFRvPCvJc66ef_530BrwlLLuFjZ0v082KmaeQTMPbbnTxTrm1miw1mmpibNEDvQcF3n5fjlf uSWU9Etn1iZalhQ9rc.TTh1uqf1RBSDs4Sot1mzfwebmuQRmyS1iKleATA96.BQ2Ybl5ZExHLlxk G3N84uQLjXkDHySJTJzSo2g2jav7hag.At1VydgP9d9iI3Na.MgKROQJtymWKUWEp1qhRasydd89 F5xvdK._HG9QrSssy6Fe38rAn_epUrxjauy_ES_5Sw X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Thu, 16 Feb 2023 12:37:37 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-vmkgs (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 85b836e040c67ba5f9ab3303f2e5aca3; Thu, 16 Feb 2023 12:35:34 +0000 (UTC) In-Reply-To: <87ilg199tt.fsf@gmx.de> (Michael Albinus's message of "Thu, 16 Feb 2023 11:35:42 +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.185.58; envelope-from=luangruo@yahoo.com; helo=sonic313-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:303409 Archived-At: Michael Albinus writes: > Andreas Schwab writes: > > Hi, > >> 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. > > For this we have file-attribute-file-identifier. So it might be > sufficient to call > > (equal (file-attribute-file-identifier f1-attr) (file-attribute-file-identifier f2-attr)) > > Best regards, Michael. This looks like the better idea, yes. Would using that be ok for Emacs 29? Or is it something for master?