Demote errors from utimensat copying directories

* lisp/files.el (copy-directory): Wrap set-file-times within
with-demoted-errors.

* src/fileio.c (Fcopy_file): Adjust commentary.
This commit is contained in:
Po Lu 2023-08-26 09:53:32 +08:00
parent 8bc21ef110
commit 349798a9b8
2 changed files with 7 additions and 3 deletions

View file

@ -6622,7 +6622,11 @@ into NEWNAME instead."
(file-attributes directory))))
(follow-flag (unless follow 'nofollow)))
(if modes (set-file-modes newname modes follow-flag))
(if times (set-file-times newname times follow-flag)))))))
(when times
;; Don't didactically fail if file times can't be set, as
;; some file systems forbid modifying them.
(with-demoted-errors "Setting file times: %s"
(set-file-times newname times follow-flag))))))))
;; At time of writing, only info uses this.

View file

@ -2518,8 +2518,8 @@ permissions. */)
ts[1] = get_stat_mtime (&st);
if (futimens (ofd, ts) != 0
/* Various versions of the Android C library are missing
futimens, which leads a gnulib fallback to be installed
that uses fdutimens instead. However, fdutimens is not
futimens, prompting Gnulib to install a fallback that
uses fdutimens instead. However, fdutimens is not
supported on many Android kernels, so just silently fail
if errno is ENOTSUP or ENOSYS. */
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY