From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: file-equal-p Date: Thu, 16 Feb 2023 10:15:07 +0100 Message-ID: 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="39743"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 16 10:16:05 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 1pSaN3-000AB4-6b for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Feb 2023 10:16:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSaMF-0004cg-8b; Thu, 16 Feb 2023 04:15:15 -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 1pSaMD-0004bg-Bz for emacs-devel@gnu.org; Thu, 16 Feb 2023 04:15:13 -0500 Original-Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSaMB-0001PY-Sj; Thu, 16 Feb 2023 04:15:13 -0500 Original-Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3B18B22047; Thu, 16 Feb 2023 09:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1676538908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=etPy7YZtperjbG8Ib7c4aqQyOpWKkvU0OYeBIpseeFk=; b=niAohvqTCl7rkQ8U9am3aBjT578oZDyINI2/iMJZq/cX5ZNHTdif0bdoEujNVXO2/UCDcF 0Thi3HFZXsJmiD4r2UGMr1sEc6OBZn9u/z3sWo/11RKrTw/dTYV7zXVbDeXEB07Xx1s8KW rulGu1KRj0l2PZQq7knvfBwvALdC0eM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1676538908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=etPy7YZtperjbG8Ib7c4aqQyOpWKkvU0OYeBIpseeFk=; b=UPf78O901JLo+D9SAYjDmKcix63xOY3HQOVnV06dR2Z8g1zqUt1zwaQVu1MM2h2PG2vWKf No6yE6Mpp89OLjDg== Original-Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 2B2072C141; Thu, 16 Feb 2023 09:15:08 +0000 (UTC) Original-Received: by hawking.suse.de (Postfix, from userid 17005) id C6CD9442F04; Thu, 16 Feb 2023 10:15:07 +0100 (CET) X-Yow: A shapely CATHOLIC SCHOOLGIRL is FIDGETING inside my costume.. In-Reply-To: <87pmaaq9ua.fsf@yahoo.com> (Po Lu's message of "Thu, 16 Feb 2023 16:43:25 +0800") Received-SPF: pass client-ip=195.135.220.28; envelope-from=schwab@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, 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: 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:303388 Archived-At: 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. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."