diff options
| author | Paul Eggert | 2020-03-07 12:04:05 -0800 |
|---|---|---|
| committer | Paul Eggert | 2020-03-07 12:15:43 -0800 |
| commit | 5d4cf1fef85bc24bc4cd9705ebb14150263ad707 (patch) | |
| tree | af696ed3ba7d2d0ab31951eba9482443d36c1456 /test | |
| parent | 9f4b260c2b98ea05a02e0ab7213156ce2e60e5a9 (diff) | |
| download | emacs-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 'test')
| -rw-r--r-- | test/lisp/filenotify-tests.el | 8 | ||||
| -rw-r--r-- | test/lisp/files-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 3 |
3 files changed, 8 insertions, 7 deletions
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 39156fbb5dc..a184fabb9ff 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -771,9 +771,9 @@ delivered." | |||
| 771 | (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) | 771 | (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) |
| 772 | ;; The next two events shall not be visible. | 772 | ;; The next two events shall not be visible. |
| 773 | (file-notify--test-read-event) | 773 | (file-notify--test-read-event) |
| 774 | (set-file-modes file-notify--test-tmpfile 000) | 774 | (set-file-modes file-notify--test-tmpfile 000 'nofollow) |
| 775 | (file-notify--test-read-event) | 775 | (file-notify--test-read-event) |
| 776 | (set-file-times file-notify--test-tmpfile '(0 0)) | 776 | (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow) |
| 777 | (file-notify--test-read-event) | 777 | (file-notify--test-read-event) |
| 778 | (delete-directory file-notify--test-tmpdir 'recursive)) | 778 | (delete-directory file-notify--test-tmpdir 'recursive)) |
| 779 | (file-notify-rm-watch file-notify--test-desc) | 779 | (file-notify-rm-watch file-notify--test-desc) |
| @@ -864,9 +864,9 @@ delivered." | |||
| 864 | (write-region | 864 | (write-region |
| 865 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 865 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 866 | (file-notify--test-read-event) | 866 | (file-notify--test-read-event) |
| 867 | (set-file-modes file-notify--test-tmpfile 000) | 867 | (set-file-modes file-notify--test-tmpfile 000 'nofollow) |
| 868 | (file-notify--test-read-event) | 868 | (file-notify--test-read-event) |
| 869 | (set-file-times file-notify--test-tmpfile '(0 0)) | 869 | (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow) |
| 870 | (file-notify--test-read-event) | 870 | (file-notify--test-read-event) |
| 871 | (delete-file file-notify--test-tmpfile)) | 871 | (delete-file file-notify--test-tmpfile)) |
| 872 | (file-notify-rm-watch file-notify--test-desc) | 872 | (file-notify-rm-watch file-notify--test-desc) |
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index ac56a7732f2..05d9ceebf1d 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -1003,9 +1003,9 @@ unquoted file names." | |||
| 1003 | 1003 | ||
| 1004 | (ert-deftest files-tests-file-name-non-special-set-file-times () | 1004 | (ert-deftest files-tests-file-name-non-special-set-file-times () |
| 1005 | (files-tests--with-temp-non-special (tmpfile nospecial) | 1005 | (files-tests--with-temp-non-special (tmpfile nospecial) |
| 1006 | (set-file-times nospecial)) | 1006 | (set-file-times nospecial nil 'nofollow)) |
| 1007 | (files-tests--with-temp-non-special-and-file-name-handler (tmpfile nospecial) | 1007 | (files-tests--with-temp-non-special-and-file-name-handler (tmpfile nospecial) |
| 1008 | (should-error (set-file-times nospecial)))) | 1008 | (should-error (set-file-times nospecial nil 'nofollow)))) |
| 1009 | 1009 | ||
| 1010 | (ert-deftest files-tests-file-name-non-special-set-visited-file-modtime () | 1010 | (ert-deftest files-tests-file-name-non-special-set-visited-file-modtime () |
| 1011 | (files-tests--with-temp-non-special (tmpfile nospecial) | 1011 | (files-tests--with-temp-non-special (tmpfile nospecial) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index be0f418c943..dcf376e70b4 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3743,7 +3743,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3743 | (file-attributes tmp-name1)))) | 3743 | (file-attributes tmp-name1)))) |
| 3744 | ;; Skip the test, if the remote handler is not able to set | 3744 | ;; Skip the test, if the remote handler is not able to set |
| 3745 | ;; the correct time. | 3745 | ;; the correct time. |
| 3746 | (skip-unless (set-file-times tmp-name1 (seconds-to-time 1))) | 3746 | (skip-unless (set-file-times tmp-name1 (seconds-to-time 1) |
| 3747 | 'nofollow)) | ||
| 3747 | ;; Dumb remote shells without perl(1) or stat(1) are not | 3748 | ;; Dumb remote shells without perl(1) or stat(1) are not |
| 3748 | ;; able to return the date correctly. They say "don't know". | 3749 | ;; able to return the date correctly. They say "don't know". |
| 3749 | (unless (tramp-compat-time-equal-p | 3750 | (unless (tramp-compat-time-equal-p |