diff options
| author | Michael Albinus | 2020-11-13 16:55:08 +0100 |
|---|---|---|
| committer | Michael Albinus | 2020-11-13 16:55:08 +0100 |
| commit | 297f89f7e4becd64c1732af6db8ba925186d1d45 (patch) | |
| tree | a422591b1cba4c1269a3cb2be430fb6fc6e379f5 | |
| parent | 206dd9d5923d5db7b44a1bf67e6ec61c027ab1d2 (diff) | |
| download | emacs-297f89f7e4becd64c1732af6db8ba925186d1d45.tar.gz emacs-297f89f7e4becd64c1732af6db8ba925186d1d45.zip | |
Some minor Tramp fixes, resulting from test campaign
* lisp/net/tramp.el (tramp-handle-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* lisp/net/tramp-smb.el (tramp-smb-handle-write-region): Use `current-time'
if needed.
* lisp/net/tramp-gvfs.el (tramp-gvfs-gio-mapping):
(tramp-gvfs-do-copy-or-rename-file): Remove "gvfs-rename", it is
not trustworthy.
* test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p): Check also for
symlinked files in trash.
(tramp-test20-file-modes): Revert last change, it was a thinko.
| -rw-r--r-- | lisp/net/tramp-adb.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 21 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 5 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 15 |
6 files changed, 32 insertions, 22 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index be83f670f72..7cdb7ebf536 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -575,8 +575,9 @@ But handle the case, if the \"test\" command is not available." | |||
| 575 | ;; Set file modification time. | 575 | ;; Set file modification time. |
| 576 | (when (or (eq visit t) (stringp visit)) | 576 | (when (or (eq visit t) (stringp visit)) |
| 577 | (set-visited-file-modtime | 577 | (set-visited-file-modtime |
| 578 | (tramp-compat-file-attribute-modification-time | 578 | (or (tramp-compat-file-attribute-modification-time |
| 579 | (file-attributes filename)))) | 579 | (file-attributes filename)) |
| 580 | (current-time)))) | ||
| 580 | 581 | ||
| 581 | ;; The end. | 582 | ;; The end. |
| 582 | (when (and (null noninteractive) | 583 | (when (and (null noninteractive) |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 86fb45a43b7..098fba56b5b 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -689,7 +689,6 @@ It has been changed in GVFS 1.14.") | |||
| 689 | ("gvfs-monitor-file" . "monitor") | 689 | ("gvfs-monitor-file" . "monitor") |
| 690 | ("gvfs-mount" . "mount") | 690 | ("gvfs-mount" . "mount") |
| 691 | ("gvfs-move" . "move") | 691 | ("gvfs-move" . "move") |
| 692 | ("gvfs-rename" . "rename") | ||
| 693 | ("gvfs-rm" . "remove") | 692 | ("gvfs-rm" . "remove") |
| 694 | ("gvfs-set-attribute" . "set")) | 693 | ("gvfs-set-attribute" . "set")) |
| 695 | "List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".") | 694 | "List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".") |
| @@ -985,15 +984,12 @@ file names." | |||
| 985 | (copy-directory filename newname keep-date t) | 984 | (copy-directory filename newname keep-date t) |
| 986 | (when (eq op 'rename) (delete-directory filename 'recursive))) | 985 | (when (eq op 'rename) (delete-directory filename 'recursive))) |
| 987 | 986 | ||
| 988 | (let* ((t1 (tramp-tramp-file-p filename)) | 987 | (let ((t1 (tramp-tramp-file-p filename)) |
| 989 | (t2 (tramp-tramp-file-p newname)) | 988 | (t2 (tramp-tramp-file-p newname)) |
| 990 | (equal-remote (tramp-equal-remote filename newname)) | 989 | (equal-remote (tramp-equal-remote filename newname)) |
| 991 | (gvfs-operation | 990 | ;; "gvfs-rename" is not trustworthy. |
| 992 | (cond | 991 | (gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move")) |
| 993 | ((eq op 'copy) "gvfs-copy") | 992 | (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) |
| 994 | (equal-remote "gvfs-rename") | ||
| 995 | (t "gvfs-move"))) | ||
| 996 | (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) | ||
| 997 | 993 | ||
| 998 | (with-parsed-tramp-file-name (if t1 filename newname) nil | 994 | (with-parsed-tramp-file-name (if t1 filename newname) nil |
| 999 | (unless (file-exists-p filename) | 995 | (unless (file-exists-p filename) |
| @@ -2439,7 +2435,10 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi." | |||
| 2439 | 2435 | ||
| 2440 | (when tramp-gvfs-enabled | 2436 | (when tramp-gvfs-enabled |
| 2441 | ;; Suppress D-Bus error messages and Tramp traces. | 2437 | ;; Suppress D-Bus error messages and Tramp traces. |
| 2442 | (let ((tramp-verbose 0) | 2438 | (let (;; Sometimes, it fails with "Variable binding depth exceeds |
| 2439 | ;; max-specpdl-size". Shall be fixed in Emacs 27. | ||
| 2440 | (max-specpdl-size (* 2 max-specpdl-size)) | ||
| 2441 | (tramp-verbose 0) | ||
| 2443 | tramp-gvfs-dbus-event-vector fun) | 2442 | tramp-gvfs-dbus-event-vector fun) |
| 2444 | ;; Add completion functions for services announced by DNS-SD. | 2443 | ;; Add completion functions for services announced by DNS-SD. |
| 2445 | ;; See <http://www.dns-sd.org/ServiceTypes.html> for valid service types. | 2444 | ;; See <http://www.dns-sd.org/ServiceTypes.html> for valid service types. |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 51e15af2ef9..ccf0c0d0e28 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3530,7 +3530,8 @@ implementation will be used." | |||
| 3530 | ;; We must pass modtime explicitly, because FILENAME can | 3530 | ;; We must pass modtime explicitly, because FILENAME can |
| 3531 | ;; be different from (buffer-file-name), f.e. if | 3531 | ;; be different from (buffer-file-name), f.e. if |
| 3532 | ;; `file-precious-flag' is set. | 3532 | ;; `file-precious-flag' is set. |
| 3533 | (tramp-compat-file-attribute-modification-time file-attr)) | 3533 | (or (tramp-compat-file-attribute-modification-time file-attr) |
| 3534 | (current-time))) | ||
| 3534 | (when (and (= (tramp-compat-file-attribute-user-id file-attr) uid) | 3535 | (when (and (= (tramp-compat-file-attribute-user-id file-attr) uid) |
| 3535 | (= (tramp-compat-file-attribute-group-id file-attr) gid)) | 3536 | (= (tramp-compat-file-attribute-group-id file-attr) gid)) |
| 3536 | (setq need-chown nil)))) | 3537 | (setq need-chown nil)))) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 0dd233aff09..8a48ffc09b8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -1630,8 +1630,9 @@ errors for shares like \"C$/\", which are common in Microsoft Windows." | |||
| 1630 | ;; Set file modification time. | 1630 | ;; Set file modification time. |
| 1631 | (when (or (eq visit t) (stringp visit)) | 1631 | (when (or (eq visit t) (stringp visit)) |
| 1632 | (set-visited-file-modtime | 1632 | (set-visited-file-modtime |
| 1633 | (tramp-compat-file-attribute-modification-time | 1633 | (or (tramp-compat-file-attribute-modification-time |
| 1634 | (file-attributes filename)))) | 1634 | (file-attributes filename)) |
| 1635 | (current-time)))) | ||
| 1635 | 1636 | ||
| 1636 | ;; The end. | 1637 | ;; The end. |
| 1637 | (when (and (null noninteractive) | 1638 | (when (and (null noninteractive) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 55f652fa9a6..a98d478bc1a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -4181,8 +4181,9 @@ of." | |||
| 4181 | ;; Set file modification time. | 4181 | ;; Set file modification time. |
| 4182 | (when (or (eq visit t) (stringp visit)) | 4182 | (when (or (eq visit t) (stringp visit)) |
| 4183 | (set-visited-file-modtime | 4183 | (set-visited-file-modtime |
| 4184 | (tramp-compat-file-attribute-modification-time | 4184 | (or (tramp-compat-file-attribute-modification-time |
| 4185 | (file-attributes filename)))) | 4185 | (file-attributes filename)) |
| 4186 | (current-time)))) | ||
| 4186 | 4187 | ||
| 4187 | ;; Set the ownership. | 4188 | ;; Set the ownership. |
| 4188 | (tramp-set-file-uid-gid filename uid gid)) | 4189 | (tramp-set-file-uid-gid filename uid gid)) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 7b83a8deebd..00d08ea6f67 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2281,9 +2281,13 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2281 | (delete-file tmp-name 'trash) | 2281 | (delete-file tmp-name 'trash) |
| 2282 | (should-not (file-exists-p tmp-name)) | 2282 | (should-not (file-exists-p tmp-name)) |
| 2283 | (should | 2283 | (should |
| 2284 | (file-exists-p | 2284 | (or (file-exists-p |
| 2285 | (expand-file-name | 2285 | (expand-file-name |
| 2286 | (file-name-nondirectory tmp-name) trash-directory))) | 2286 | (file-name-nondirectory tmp-name) trash-directory)) |
| 2287 | ;; Gdrive. | ||
| 2288 | (file-symlink-p | ||
| 2289 | (expand-file-name | ||
| 2290 | (file-name-nondirectory tmp-name) trash-directory)))) | ||
| 2287 | (delete-directory trash-directory 'recursive) | 2291 | (delete-directory trash-directory 'recursive) |
| 2288 | (should-not (file-exists-p trash-directory))))))) | 2292 | (should-not (file-exists-p trash-directory))))))) |
| 2289 | 2293 | ||
| @@ -3473,7 +3477,10 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 3473 | (skip-unless | 3477 | (skip-unless |
| 3474 | (or (tramp--test-sh-p) (tramp--test-sudoedit-p) | 3478 | (or (tramp--test-sh-p) (tramp--test-sudoedit-p) |
| 3475 | ;; Not all tramp-gvfs.el methods support changing the file mode. | 3479 | ;; Not all tramp-gvfs.el methods support changing the file mode. |
| 3476 | (tramp--test-gvfs-p "afp") (tramp--test-gvfs-p "ftp"))) | 3480 | (and |
| 3481 | (tramp--test-gvfs-p) | ||
| 3482 | (string-match-p | ||
| 3483 | "ftp" (file-remote-p tramp-test-temporary-file-directory 'method))))) | ||
| 3477 | 3484 | ||
| 3478 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) | 3485 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) |
| 3479 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 3486 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |