diff options
| author | Michael Albinus | 2022-09-17 17:50:38 +0200 |
|---|---|---|
| committer | Michael Albinus | 2022-09-17 17:50:38 +0200 |
| commit | e2c3ce24023f8daee32d49b3724adbf43de9fc92 (patch) | |
| tree | c092f1fdf2da5fe85ad20a62b85663a1b03979e8 /lisp | |
| parent | 320f0cac8008a54b988c0166dbfd195f5de8790f (diff) | |
| download | emacs-e2c3ce24023f8daee32d49b3724adbf43de9fc92.tar.gz emacs-e2c3ce24023f8daee32d49b3724adbf43de9fc92.zip | |
Sync with Tramp 2.5.3.2. Don't merge with master
* doc/misc/tramp.texi (Android shell setup): Rework.
(Frequently Asked Questions): Improve recommendations for speeding up.
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.5.4-pre".
* lisp/net/tramp-adb.el (tramp-methods): Use "%d".
(tramp-adb-handle-directory-files-and-attributes): Fix "." and
".." in listing.
(tramp-adb-handle-file-attributes)
(tramp-adb-handle-directory-files-and-attributes)
(tramp-adb-handle-file-name-all-completions): Pipe "ls" output
through "cat", in order to avoid quoting special characters.
(tramp-adb-maybe-open-connection): Compute args from `tramp-login-args'.
* lisp/net/tramp-compat.el (tramp-compat-replace-regexp-in-region):
New defalias.
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file):
Adapt check for proper remote command.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-handle-make-process): Check for adb device if indicated.
(tramp-get-remote-tmpdir): Cache result in temporary connection
property.
* test/lisp/net/tramp-tests.el (tramp-test17-insert-directory)
(tramp-test22-file-times, tramp--test-utf8): Adapt tests.
(tramp--test-shell-file-name): Do not depend on `tramp--test-adb-p'.
(tramp-test46-unload): Ignore autoload functions in
`tramp-file-name' structure tests, since `tramp-file-name-handler'
is also autoloaded in Emacs 29.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-adb.el | 29 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 23 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 14 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 11 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 6 |
5 files changed, 59 insertions, 24 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 1fe10a560b1..53796503bcd 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -95,7 +95,7 @@ It is used for TCP/IP devices." | |||
| 95 | (add-to-list 'tramp-methods | 95 | (add-to-list 'tramp-methods |
| 96 | `(,tramp-adb-method | 96 | `(,tramp-adb-method |
| 97 | (tramp-login-program ,tramp-adb-program) | 97 | (tramp-login-program ,tramp-adb-program) |
| 98 | (tramp-login-args (("shell"))) | 98 | (tramp-login-args (("-s" "%d") ("shell"))) |
| 99 | (tramp-direct-async t) | 99 | (tramp-direct-async t) |
| 100 | (tramp-tmpdir "/data/local/tmp") | 100 | (tramp-tmpdir "/data/local/tmp") |
| 101 | (tramp-default-port 5555))) | 101 | (tramp-default-port 5555))) |
| @@ -256,7 +256,7 @@ arguments to pass to the OPERATION." | |||
| 256 | v localname (format "file-attributes-%s" id-format) | 256 | v localname (format "file-attributes-%s" id-format) |
| 257 | (and | 257 | (and |
| 258 | (tramp-adb-send-command-and-check | 258 | (tramp-adb-send-command-and-check |
| 259 | v (format "%s -d -l %s" | 259 | v (format "%s -d -l %s | cat" |
| 260 | (tramp-adb-get-ls-command v) | 260 | (tramp-adb-get-ls-command v) |
| 261 | (tramp-shell-quote-argument localname))) | 261 | (tramp-shell-quote-argument localname))) |
| 262 | (with-current-buffer (tramp-get-buffer v) | 262 | (with-current-buffer (tramp-get-buffer v) |
| @@ -315,20 +315,25 @@ arguments to pass to the OPERATION." | |||
| 315 | full match id-format nosort count) | 315 | full match id-format nosort count) |
| 316 | (with-current-buffer (tramp-get-buffer v) | 316 | (with-current-buffer (tramp-get-buffer v) |
| 317 | (when (tramp-adb-send-command-and-check | 317 | (when (tramp-adb-send-command-and-check |
| 318 | v (format "%s -a -l %s" | 318 | v (format "%s -a -l %s | cat" |
| 319 | (tramp-adb-get-ls-command v) | 319 | (tramp-adb-get-ls-command v) |
| 320 | (tramp-shell-quote-argument localname))) | 320 | (tramp-shell-quote-argument localname))) |
| 321 | ;; We insert also filename/. and filename/.., because "ls" doesn't. | 321 | ;; We insert also filename/. and filename/.., because |
| 322 | ;; Looks like it does include them in toybox, since Android 6. | 322 | ;; "ls" doesn't on some file systems, like "sdcard". |
| 323 | (unless (re-search-backward "\\.$" nil t) | 323 | (unless (re-search-backward "\\.$" nil t) |
| 324 | (narrow-to-region (point-max) (point-max)) | 324 | (narrow-to-region (point-max) (point-max)) |
| 325 | (tramp-adb-send-command | 325 | (tramp-adb-send-command |
| 326 | v (format "%s -d -a -l %s %s" | 326 | v (format "%s -d -a -l %s %s | cat" |
| 327 | (tramp-adb-get-ls-command v) | 327 | (tramp-adb-get-ls-command v) |
| 328 | (tramp-shell-quote-argument | 328 | (tramp-shell-quote-argument |
| 329 | (tramp-compat-file-name-concat localname ".")) | 329 | (tramp-compat-file-name-concat localname ".")) |
| 330 | (tramp-shell-quote-argument | 330 | (tramp-shell-quote-argument |
| 331 | (tramp-compat-file-name-concat localname "..")))) | 331 | (tramp-compat-file-name-concat localname "..")))) |
| 332 | (tramp-compat-replace-regexp-in-region | ||
| 333 | (regexp-quote | ||
| 334 | (tramp-compat-file-name-unquote | ||
| 335 | (file-name-as-directory localname))) | ||
| 336 | "" (point-min)) | ||
| 332 | (widen))) | 337 | (widen))) |
| 333 | (tramp-adb-sh-fix-ls-output) | 338 | (tramp-adb-sh-fix-ls-output) |
| 334 | (let ((result (tramp-do-parse-file-attributes-with-ls | 339 | (let ((result (tramp-do-parse-file-attributes-with-ls |
| @@ -474,7 +479,7 @@ Emacs dired can't find files." | |||
| 474 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 479 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| 475 | (with-tramp-file-property v localname "file-name-all-completions" | 480 | (with-tramp-file-property v localname "file-name-all-completions" |
| 476 | (tramp-adb-send-command | 481 | (tramp-adb-send-command |
| 477 | v (format "%s -a %s" | 482 | v (format "%s -a %s | cat" |
| 478 | (tramp-adb-get-ls-command v) | 483 | (tramp-adb-get-ls-command v) |
| 479 | (tramp-shell-quote-argument localname))) | 484 | (tramp-shell-quote-argument localname))) |
| 480 | (mapcar | 485 | (mapcar |
| @@ -485,9 +490,8 @@ Emacs dired can't find files." | |||
| 485 | (with-current-buffer (tramp-get-buffer v) | 490 | (with-current-buffer (tramp-get-buffer v) |
| 486 | (delete-dups | 491 | (delete-dups |
| 487 | (append | 492 | (append |
| 488 | ;; In older Android versions, "." and ".." are not | 493 | ;; On some file systems like "sdcard", "." and ".." are |
| 489 | ;; included. In newer versions (toybox, since Android 6) | 494 | ;; not included. We fix this by `delete-dups'. |
| 490 | ;; they are. We fix this by `delete-dups'. | ||
| 491 | '("." "..") | 495 | '("." "..") |
| 492 | (delq | 496 | (delq |
| 493 | nil | 497 | nil |
| @@ -1270,9 +1274,8 @@ connection if a previous connection has died for some reason." | |||
| 1270 | (with-tramp-progress-reporter vec 3 "Opening adb shell connection" | 1274 | (with-tramp-progress-reporter vec 3 "Opening adb shell connection" |
| 1271 | (let* ((coding-system-for-read 'utf-8-dos) ; Is this correct? | 1275 | (let* ((coding-system-for-read 'utf-8-dos) ; Is this correct? |
| 1272 | (process-connection-type tramp-process-connection-type) | 1276 | (process-connection-type tramp-process-connection-type) |
| 1273 | (args (if (> (length host) 0) | 1277 | (args (tramp-expand-args |
| 1274 | (list "-s" device "shell") | 1278 | vec 'tramp-login-args ?d (or device ""))) |
| 1275 | (list "shell"))) | ||
| 1276 | (p (let ((default-directory | 1279 | (p (let ((default-directory |
| 1277 | tramp-compat-temporary-file-directory)) | 1280 | tramp-compat-temporary-file-directory)) |
| 1278 | (apply #'start-process (tramp-get-connection-name vec) buf | 1281 | (apply #'start-process (tramp-get-connection-name vec) buf |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index aead1dedd24..91c450eee4e 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -398,6 +398,29 @@ CONDITION can also be a list of error conditions." | |||
| 398 | (car components)) | 398 | (car components)) |
| 399 | (cdr components))))))) | 399 | (cdr components))))))) |
| 400 | 400 | ||
| 401 | ;; Function `replace-regexp-in-region' is new in Emacs 28.1. | ||
| 402 | (defalias 'tramp-compat-replace-regexp-in-region | ||
| 403 | (if (fboundp 'replace-regexp-in-region) | ||
| 404 | #'replace-regexp-in-region | ||
| 405 | (lambda (regexp replacement &optional start end) | ||
| 406 | (if start | ||
| 407 | (when (< start (point-min)) | ||
| 408 | (error "Start before start of buffer")) | ||
| 409 | (setq start (point))) | ||
| 410 | (if end | ||
| 411 | (when (> end (point-max)) | ||
| 412 | (error "End after end of buffer")) | ||
| 413 | (setq end (point-max))) | ||
| 414 | (save-excursion | ||
| 415 | (let ((matches 0) | ||
| 416 | (case-fold-search nil)) | ||
| 417 | (goto-char start) | ||
| 418 | (while (re-search-forward regexp end t) | ||
| 419 | (replace-match replacement t) | ||
| 420 | (setq matches (1+ matches))) | ||
| 421 | (and (not (zerop matches)) | ||
| 422 | matches)))))) | ||
| 423 | |||
| 401 | (dolist (elt (all-completions "tramp-compat-" obarray 'functionp)) | 424 | (dolist (elt (all-completions "tramp-compat-" obarray 'functionp)) |
| 402 | (put (intern elt) 'tramp-suppress-trace t)) | 425 | (put (intern elt) 'tramp-suppress-trace t)) |
| 403 | 426 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index e0b786f015a..207e588f347 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1053,12 +1053,14 @@ file names." | |||
| 1053 | ;; code in case of direct copy/move. Apply | 1053 | ;; code in case of direct copy/move. Apply |
| 1054 | ;; sanity checks. | 1054 | ;; sanity checks. |
| 1055 | (or (not equal-remote) | 1055 | (or (not equal-remote) |
| 1056 | (tramp-gvfs-send-command | 1056 | (and |
| 1057 | v "gvfs-info" (tramp-gvfs-url-file-name newname)) | 1057 | (tramp-gvfs-send-command |
| 1058 | (eq op 'copy) | 1058 | v "gvfs-info" |
| 1059 | (not (tramp-gvfs-send-command | 1059 | (tramp-gvfs-url-file-name newname)) |
| 1060 | v "gvfs-info" | 1060 | (or (eq op 'copy) |
| 1061 | (tramp-gvfs-url-file-name filename))))) | 1061 | (not (tramp-gvfs-send-command |
| 1062 | v "gvfs-info" | ||
| 1063 | (tramp-gvfs-url-file-name filename))))))) | ||
| 1062 | 1064 | ||
| 1063 | (if (or (not equal-remote) | 1065 | (if (or (not equal-remote) |
| 1064 | (and equal-remote | 1066 | (and equal-remote |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 95d674911f3..f7243625c7c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -257,6 +257,7 @@ pair of the form (KEY VALUE). The following KEYs are defined: | |||
| 257 | argument if it is supported. | 257 | argument if it is supported. |
| 258 | - \"%y\" is replaced by the `tramp-scp-force-scp-protocol' | 258 | - \"%y\" is replaced by the `tramp-scp-force-scp-protocol' |
| 259 | argument if it is supported. | 259 | argument if it is supported. |
| 260 | - \"%d\" is replaced by the device detected by `tramp-adb-get-device'. | ||
| 260 | 261 | ||
| 261 | The existence of `tramp-login-args', combined with the | 262 | The existence of `tramp-login-args', combined with the |
| 262 | absence of `tramp-copy-args', is an indication that the | 263 | absence of `tramp-copy-args', is an indication that the |
| @@ -4244,6 +4245,8 @@ substitution. SPEC-LIST is a list of char/value pairs used for | |||
| 4244 | ;; is different between tramp-sh.el, and tramp-adb.el or | 4245 | ;; is different between tramp-sh.el, and tramp-adb.el or |
| 4245 | ;; tramp-sshfs.el. | 4246 | ;; tramp-sshfs.el. |
| 4246 | (let* ((sh-file-name-handler-p (tramp-sh-file-name-handler-p v)) | 4247 | (let* ((sh-file-name-handler-p (tramp-sh-file-name-handler-p v)) |
| 4248 | (adb-file-name-handler-p | ||
| 4249 | (tramp-adb-file-name-p (tramp-make-tramp-file-name v))) | ||
| 4247 | (login-program | 4250 | (login-program |
| 4248 | (tramp-get-method-parameter v 'tramp-login-program)) | 4251 | (tramp-get-method-parameter v 'tramp-login-program)) |
| 4249 | ;; We don't create the temporary file. In fact, it | 4252 | ;; We don't create the temporary file. In fact, it |
| @@ -4263,6 +4266,10 @@ substitution. SPEC-LIST is a list of char/value pairs used for | |||
| 4263 | (when sh-file-name-handler-p | 4266 | (when sh-file-name-handler-p |
| 4264 | (tramp-compat-funcall | 4267 | (tramp-compat-funcall |
| 4265 | 'tramp-ssh-controlmaster-options v))) | 4268 | 'tramp-ssh-controlmaster-options v))) |
| 4269 | (device | ||
| 4270 | (when adb-file-name-handler-p | ||
| 4271 | (tramp-compat-funcall | ||
| 4272 | 'tramp-adb-get-device v))) | ||
| 4266 | login-args p) | 4273 | login-args p) |
| 4267 | 4274 | ||
| 4268 | ;; Replace `login-args' place holders. Split | 4275 | ;; Replace `login-args' place holders. Split |
| @@ -4279,7 +4286,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for | |||
| 4279 | v 'tramp-login-args | 4286 | v 'tramp-login-args |
| 4280 | ?h (or host "") ?u (or user "") ?p (or port "") | 4287 | ?h (or host "") ?u (or user "") ?p (or port "") |
| 4281 | ?c (format-spec (or options "") (format-spec-make ?t tmpfile)) | 4288 | ?c (format-spec (or options "") (format-spec-make ?t tmpfile)) |
| 4282 | ?l "")))) | 4289 | ?d (or device "") ?l "")))) |
| 4283 | p (make-process | 4290 | p (make-process |
| 4284 | :name name :buffer buffer | 4291 | :name name :buffer buffer |
| 4285 | :command (append `(,login-program) login-args command) | 4292 | :command (append `(,login-program) login-args command) |
| @@ -5451,7 +5458,7 @@ This handles also chrooted environments, which are not regarded as local." | |||
| 5451 | 5458 | ||
| 5452 | (defun tramp-get-remote-tmpdir (vec) | 5459 | (defun tramp-get-remote-tmpdir (vec) |
| 5453 | "Return directory for temporary files on the remote host identified by VEC." | 5460 | "Return directory for temporary files on the remote host identified by VEC." |
| 5454 | (with-tramp-connection-property vec "tmpdir" | 5461 | (with-tramp-connection-property (tramp-get-process vec) "remote-tmpdir" |
| 5455 | (let ((dir | 5462 | (let ((dir |
| 5456 | (tramp-make-tramp-file-name | 5463 | (tramp-make-tramp-file-name |
| 5457 | vec (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp")))) | 5464 | vec (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp")))) |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index e14c26d8999..80a533cb992 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Maintainer: Michael Albinus <michael.albinus@gmx.de> | 7 | ;; Maintainer: Michael Albinus <michael.albinus@gmx.de> |
| 8 | ;; Keywords: comm, processes | 8 | ;; Keywords: comm, processes |
| 9 | ;; Package: tramp | 9 | ;; Package: tramp |
| 10 | ;; Version: 2.5.3.28.2 | 10 | ;; Version: 2.5.4-pre |
| 11 | ;; Package-Requires: ((emacs "25.1")) | 11 | ;; Package-Requires: ((emacs "25.1")) |
| 12 | ;; Package-Type: multi | 12 | ;; Package-Type: multi |
| 13 | ;; URL: https://www.gnu.org/software/tramp/ | 13 | ;; URL: https://www.gnu.org/software/tramp/ |
| @@ -40,7 +40,7 @@ | |||
| 40 | ;; ./configure" to change them. | 40 | ;; ./configure" to change them. |
| 41 | 41 | ||
| 42 | ;;;###tramp-autoload | 42 | ;;;###tramp-autoload |
| 43 | (defconst tramp-version "2.5.3.28.2" | 43 | (defconst tramp-version "2.5.4-pre" |
| 44 | "This version of Tramp.") | 44 | "This version of Tramp.") |
| 45 | 45 | ||
| 46 | ;;;###tramp-autoload | 46 | ;;;###tramp-autoload |
| @@ -78,7 +78,7 @@ | |||
| 78 | ;; Check for Emacs version. | 78 | ;; Check for Emacs version. |
| 79 | (let ((x (if (not (string-lessp emacs-version "25.1")) | 79 | (let ((x (if (not (string-lessp emacs-version "25.1")) |
| 80 | "ok" | 80 | "ok" |
| 81 | (format "Tramp 2.5.3.28.2 is not fit for %s" | 81 | (format "Tramp 2.5.4-pre is not fit for %s" |
| 82 | (replace-regexp-in-string "\n" "" (emacs-version)))))) | 82 | (replace-regexp-in-string "\n" "" (emacs-version)))))) |
| 83 | (unless (string-equal "ok" x) (error "%s" x))) | 83 | (unless (string-equal "ok" x) (error "%s" x))) |
| 84 | 84 | ||