[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file-equal-p
From: |
Po Lu |
Subject: |
Re: file-equal-p |
Date: |
Thu, 16 Feb 2023 16:43:25 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
> Fix Haiku? A 'stat' call accesses the directory and file's meta-data,
> not the file itself, so what Haiku does makes no sense, IMO.
>
> But if you cannot fix Haiku, a suitable haiku-only change in
> file-equal-p, whereby the access times are exempt from comparison, is
> a possibility.
Something like this?
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)))))))
(defun file-in-directory-p (file dir)
"Return non-nil if DIR is a parent directory of FILE.
BTW, what if a file changes in between the calls to `file-atttributes'
on any old GNU/Linux system?
Thanks.
- file-equal-p, Po Lu, 2023/02/15
- Re: file-equal-p, Eli Zaretskii, 2023/02/16
- Re: file-equal-p,
Po Lu <=
- Re: file-equal-p, Eli Zaretskii, 2023/02/16
- Re: file-equal-p, Po Lu, 2023/02/16
- Re: file-equal-p, Eli Zaretskii, 2023/02/16
- Re: file-equal-p, Po Lu, 2023/02/16
- Re: file-equal-p, Eli Zaretskii, 2023/02/16
- Re: file-equal-p, Po Lu, 2023/02/16
- Re: file-equal-p, Eli Zaretskii, 2023/02/17
- Re: file-equal-p, Po Lu, 2023/02/17
- Re: file-equal-p, Eli Zaretskii, 2023/02/17
- Re: file-equal-p, Po Lu, 2023/02/17