* lisp/files.el (file-equal-p): Work around Haiku stat bug.

This commit is contained in:
Po Lu 2023-02-18 11:03:07 +08:00
parent 13fd7667f9
commit 3e74763099

View file

@ -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.