diff options
| author | Michael Albinus | 2022-08-03 17:30:09 +0200 |
|---|---|---|
| committer | Michael Albinus | 2022-08-03 17:30:09 +0200 |
| commit | 21afc26d4df6bae35ba032d4b6b03fb7fb2bf1b3 (patch) | |
| tree | d9144d4fc404365fcdc431293d8358a067a909b5 /test | |
| parent | 3ec6b806b246c147ae30408a1d659083619883af (diff) | |
| download | emacs-21afc26d4df6bae35ba032d4b6b03fb7fb2bf1b3.tar.gz emacs-21afc26d4df6bae35ba032d4b6b03fb7fb2bf1b3.zip | |
Reorganize Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region): Handle special
case that START is "".
(tramp-adb-handle-set-file-modes)
(tramp-adb-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-adb-handle-make-process):
Use `with-tramp-saved-connection-properties'.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
Use `tramp-archive-handle-file-exists-p'.
(tramp-archive-handle-file-exists-p): New defun.
(tramp-archive-file-name-handler): Add ;;;###tramp-autoload cookie.
* lisp/net/tramp-cache.el (tramp-compat, tramp-loaddefs)
(time-stamp): Require.
(tramp-get-file-property, tramp-set-file-property)
(tramp-flush-file-property, tramp-flush-file-upper-properties)
(tramp-flush-file-properties): Use `tramp-file-name-unify'. Adapt
message.
(tramp-flush-directory-properties): Simplify.
(tramp-flush-file-function): Add ;;;###tramp-autoload cookie.
Don't use `with-parsed-tramp-file-name', it isn't exposed.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Macros moved from tramp.el.
(with-tramp-saved-file-property)
(with-tramp-saved-file-properties)
(with-tramp-saved-connection-properties): New defmacros.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Flush "/".
* lisp/net/tramp-crypt.el (tramp-crypt-handle-set-file-modes)
(tramp-crypt-handle-set-file-times)
(tramp-crypt-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-ftp.el (tramp-archive-file-name-handler):
Don't declare.
* lisp/net/tramp-gvfs.el (tramp-gvfs-info): New defun.
(tramp-gvfs-do-copy-or-rename-file)
(tramp-gvfs-handle-delete-directory)
(tramp-gvfs-handle-delete-file, tramp-gvfs-get-root-attributes)
(tramp-gvfs-handle-make-directory): Use it.
(tramp-gvfs-handle-set-file-modes)
(tramp-gvfs-handle-set-file-times)
(tramp-gvfs-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link):
Expand TARGET when flushing file properties.
(tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times)
(tramp-sh-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-sh-handle-file-name-all-completions): Protect, when
connection is not established yet.
(tramp-do-copy-or-rename-file-directly): Flush file properties of
NEWNAME when constructing a new remote file name.
(tramp-do-copy-or-rename-file-out-of-band, tramp-sh-handle-make-process):
Use `with-tramp-saved-connection-properties'.
(tramp-sh-handle-delete-file): Flush file properties only after
deleting, otherwise we get a false alarm.
(tramp-sh-handle-process-file): Flush "/".
(tramp-sh-handle-write-region): Handle special case that START is "".
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-process-file)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-start-file-process):
Use `with-tramp-saved-connection-properties'.
(tramp-smb-remote-acl-p): New defun.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl): Use it.
(tramp-smb-handle-set-file-modes):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
(tramp-smb-handle-process-file, tramp-smb-maybe-open-connection):
Flush "/".
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file): Flush "/".
(tramp-sshfs-handle-set-file-modes)
(tramp-sshfs-handle-set-file-times):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes)
(tramp-sudoedit-handle-set-file-times)
(tramp-sudoedit-handle-set-file-uid-gid):
Use `tramp-skeleton-set-file-modes-times-uid-gid'.
* lisp/net/tramp.el (tramp-archive-file-name-handler): Don't declare.
(tramp-verbose, tramp-file-name-unify, tramp-tramp-file-p)
(tramp-file-local-name, tramp-dissect-file-name)
(tramp-make-tramp-file-name, tramp-get-connection-buffer)
(tramp-get-buffer-string, tramp-debug-message)
(tramp-inhibit-progress-reporter, tramp-message):
Add ;;;###tramp-autoload cookie.
(tramp-file-name): Expose defstruct to tramp-loaddefs.el
(tramp-file-name-unify): New optional arg FILE.
(tramp-get-default-directory, tramp-get-buffer-string)
(tramp-message, tramp-backtrace, tramp-error-with-buffer)
(tramp-with-demoted-errors, tramp-barf-if-file-missing)
(tramp-skeleton-copy-directory, tramp-skeleton-delete-directory)
(tramp-skeleton-directory-files)
(tramp-skeleton-directory-files-and-attributes)
(tramp-skeleton-file-local-copy, tramp-skeleton-write-region):
Remove `tramp-suppress-trace' property, it isn't needed for
defmacros and defsubsts.
(with-tramp-file-property, with-tramp-connection-property)
(with-tramp-saved-connection-property): Move macros to tramp-cache.el.
(tramp-skeleton-directory-files-and-attributes): Fix implementation.
(tramp-skeleton-file-local-copy): Fix docstring.
(tramp-skeleton-set-file-modes-times-uid-gid): New defmacro.
(tramp-skeleton-write-region): Set "file-exists-p" cache property.
(tramp-handle-file-exists-p): Use cached value.
(tramp-process-sentinel): Flush "/".
(tramp-make-tramp-temp-file): Suppress also `tramp-smb-remote-acl-p'.
(tramp-get-connection-buffer):
* test/lisp/net/tramp-tests.el (tramp-test10-write-region)
(tramp-test20-file-modes, tramp-test22-file-times): Extend tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 5a8d9100e18..63ccd05a263 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2481,6 +2481,19 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2481 | (insert-file-contents tmp-name) | 2481 | (insert-file-contents tmp-name) |
| 2482 | (should (string-equal (buffer-string) "foo"))) | 2482 | (should (string-equal (buffer-string) "foo"))) |
| 2483 | 2483 | ||
| 2484 | ;; Write empty string. Used for creation of temprorary files. | ||
| 2485 | ;; Since Emacs 27.1. | ||
| 2486 | (when (fboundp 'make-empty-file) | ||
| 2487 | (with-no-warnings | ||
| 2488 | (should-error | ||
| 2489 | (make-empty-file tmp-name) | ||
| 2490 | :type 'file-already-exists) | ||
| 2491 | (delete-file tmp-name) | ||
| 2492 | (make-empty-file tmp-name) | ||
| 2493 | (with-temp-buffer | ||
| 2494 | (insert-file-contents tmp-name) | ||
| 2495 | (should (string-equal (buffer-string) ""))))) | ||
| 2496 | |||
| 2484 | ;; Write partly. | 2497 | ;; Write partly. |
| 2485 | (with-temp-buffer | 2498 | (with-temp-buffer |
| 2486 | (insert "123456789") | 2499 | (insert "123456789") |
| @@ -3790,7 +3803,11 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 3790 | (when (tramp--test-emacs28-p) | 3803 | (when (tramp--test-emacs28-p) |
| 3791 | (with-no-warnings | 3804 | (with-no-warnings |
| 3792 | (set-file-modes tmp-name1 #o222 'nofollow) | 3805 | (set-file-modes tmp-name1 #o222 'nofollow) |
| 3793 | (should (= (file-modes tmp-name1 'nofollow) #o222))))) | 3806 | (should (= (file-modes tmp-name1 'nofollow) #o222)))) |
| 3807 | ;; Setting the mode for not existing files shall fail. | ||
| 3808 | (should-error | ||
| 3809 | (set-file-modes tmp-name2 #o777) | ||
| 3810 | :type 'file-missing)) | ||
| 3794 | 3811 | ||
| 3795 | ;; Cleanup. | 3812 | ;; Cleanup. |
| 3796 | (ignore-errors (delete-file tmp-name1))) | 3813 | (ignore-errors (delete-file tmp-name1))) |
| @@ -4153,6 +4170,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4153 | (tramp-compat-time-equal-p | 4170 | (tramp-compat-time-equal-p |
| 4154 | (file-attribute-modification-time (file-attributes tmp-name1)) | 4171 | (file-attribute-modification-time (file-attributes tmp-name1)) |
| 4155 | (seconds-to-time 1))) | 4172 | (seconds-to-time 1))) |
| 4173 | ;; Setting the time for not existing files shall fail. | ||
| 4174 | (should-error | ||
| 4175 | (set-file-times tmp-name2) | ||
| 4176 | :type 'file-missing) | ||
| 4156 | (write-region "bla" nil tmp-name2) | 4177 | (write-region "bla" nil tmp-name2) |
| 4157 | (should (file-exists-p tmp-name2)) | 4178 | (should (file-exists-p tmp-name2)) |
| 4158 | (should (file-newer-than-file-p tmp-name2 tmp-name1)) | 4179 | (should (file-newer-than-file-p tmp-name2 tmp-name1)) |