aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorPaul Eggert2020-03-07 12:04:05 -0800
committerPaul Eggert2020-03-07 12:15:43 -0800
commit5d4cf1fef85bc24bc4cd9705ebb14150263ad707 (patch)
treeaf696ed3ba7d2d0ab31951eba9482443d36c1456 /doc/lispref
parent9f4b260c2b98ea05a02e0ab7213156ce2e60e5a9 (diff)
downloademacs-5d4cf1fef85bc24bc4cd9705ebb14150263ad707.tar.gz
emacs-5d4cf1fef85bc24bc4cd9705ebb14150263ad707.zip
Add ‘nofollow’ flag to set-file-times
This is a companion to the recent set-file-modes patch. It adds support for a ‘nofollow’ flag to set-file-times (Bug#39773). Like the set-file-modes patch, it needs work in the w32 port. * admin/merge-gnulib (GNULIB_MODULES): Add futimens, utimensat. Remove utimens. * doc/lispref/files.texi (Changing Files): * etc/NEWS: Mention the change. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lisp/files.el (copy-directory): * lisp/gnus/gnus-cloud.el (gnus-cloud-replace-file): * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): * lisp/tar-mode.el (tar-copy): * test/lisp/filenotify-tests.el (file-notify-test03-events): * test/lisp/files-tests.el: (files-tests-file-name-non-special-set-file-times): * test/lisp/net/tramp-tests.el (tramp-test22-file-times): When setting file times, avoid following symbolic links when the file is not supposed to be a symbolic link. * lib/futimens.c, lib/utimensat.c, m4/futimens.m4, m4/utimensat.m4: New files, copied from Gnulib. * lisp/gnus/gnus-cloud.el (gnus-cloud-replace-file): When creating a file that is not supposed to exist already, use the excl flag to check this. * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times): * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-times): Accept an optional FLAG arg that is currently ignored, and add a FIXME comment for it. * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-times): * src/fileio.c (Fset_file_times): Support an optional FLAG arg. * src/fileio.c (Fcopy_file): Use futimens instead of set_file_times, as it’s simpler and is a POSIX API. * src/sysdep.c (set_file_times): Move from here ... * src/w32.c (set_file_times): ... to here, and make it static, since it is now used only in w32.c. Presumably w32.c should also add support for futimens and utimensat (the POSIX APIs, which Emacs now uses) and it can remove fdutimens (the Gnulib API, which Emacs no longer uses).
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/files.texi10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index a69a4e5dd38..b3ad9b99649 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1909,11 +1909,19 @@ omitted or @code{nil}, it defaults to 0, i.e., no access rights at
1909all. 1909all.
1910@end defun 1910@end defun
1911 1911
1912@defun set-file-times filename &optional time 1912@defun set-file-times filename &optional time flag
1913This function sets the access and modification times of @var{filename} 1913This function sets the access and modification times of @var{filename}
1914to @var{time}. The return value is @code{t} if the times are successfully 1914to @var{time}. The return value is @code{t} if the times are successfully
1915set, otherwise it is @code{nil}. @var{time} defaults to the current 1915set, otherwise it is @code{nil}. @var{time} defaults to the current
1916time and must be a time value (@pxref{Time of Day}). 1916time and must be a time value (@pxref{Time of Day}).
1917
1918By default this function follows symbolic links. However, if the
1919optional argument @var{flag} is the symbol @code{nofollow}, this
1920function does not follow @var{filename} if it is a symbolic link;
1921this can help prevent inadvertently changing the times of a file
1922somewhere else. On platforms that do not support changing times
1923on a symbolic link, this function signals an error when @var{filename}
1924is a symbolic link and @var{flag} is @code{nofollow}.
1917@end defun 1925@end defun
1918 1926
1919@defun set-file-extended-attributes filename attribute-alist 1927@defun set-file-extended-attributes filename attribute-alist