emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 3e747630999 2/2: * lisp/files.el (file-equal-p): Work around Ha


From: Po Lu
Subject: emacs-29 3e747630999 2/2: * lisp/files.el (file-equal-p): Work around Haiku stat bug.
Date: Fri, 17 Feb 2023 22:03:53 -0500 (EST)

branch: emacs-29
commit 3e747630999894553e2726f81b7d13da46b96350
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    * lisp/files.el (file-equal-p): Work around Haiku stat bug.
---
 lisp/files.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index 0d24852358e..57e01340359 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6357,7 +6357,18 @@ If FILE1 or FILE2 does not exist, the return value is 
unspecified."
       (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.
+               (or (equal f1-attr f2-attr)
+                   (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)))))))))
 
 (defun file-in-directory-p (file dir)
   "Return non-nil if DIR is a parent directory of FILE.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]