From: Po Lu Date: Sat, 18 Feb 2023 03:03:07 +0000 (+0800) Subject: * lisp/files.el (file-equal-p): Work around Haiku stat bug. X-Git-Tag: emacs-29.0.90~417 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3e747630999894553e2726f81b7d13da46b96350;p=emacs.git * lisp/files.el (file-equal-p): Work around Haiku stat bug. --- 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.