From 3e747630999894553e2726f81b7d13da46b96350 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 18 Feb 2023 11:03:07 +0800 Subject: [PATCH] * 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. -- 2.39.2