Several Tramp cleanups
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection): Move setting of sentinel up. * lisp/net/tramp-cache.el (tramp-get-connection-property) (tramp-set-connection-property): Don't raise a debug message for the `tramp-cache-version' key. * lisp/net/tramp.el (tramp-convert-file-attributes): Don't cache "file-attributes-ID-FORMAT". * test/lisp/net/tramp-tests.el (tramp--test-enabled): Cleanup also `tramp-compat-temporary-file-directory'. (tramp-test32-shell-command): Use `async-shell-command-width' of 512. (tramp-test36-vc-registered): Remove double let* entry.
This commit is contained in:
parent
3ff9205448
commit
1e3d72d962
4 changed files with 27 additions and 25 deletions
|
@ -1126,6 +1126,11 @@ connection if a previous connection has died for some reason."
|
|||
tramp-adb-program args)))
|
||||
(prompt (md5 (concat (prin1-to-string process-environment)
|
||||
(current-time-string)))))
|
||||
|
||||
;; Set sentinel. Initialize variables.
|
||||
(set-process-sentinel p #'tramp-process-sentinel)
|
||||
(tramp-post-process-creation p vec)
|
||||
|
||||
;; Wait for initial prompt. On some devices, it needs
|
||||
;; an initial RET, in order to get it.
|
||||
(sleep-for 0.1)
|
||||
|
@ -1134,10 +1139,6 @@ connection if a previous connection has died for some reason."
|
|||
(unless (process-live-p p)
|
||||
(tramp-error vec 'file-error "Terminated!"))
|
||||
|
||||
;; Set sentinel. Initialize variables.
|
||||
(set-process-sentinel p #'tramp-process-sentinel)
|
||||
(tramp-post-process-creation p vec)
|
||||
|
||||
;; Set connection-local variables.
|
||||
(tramp-set-connection-local-variables vec)
|
||||
|
||||
|
|
|
@ -396,7 +396,8 @@ the connection, return DEFAULT."
|
|||
(not (and (processp key) (not (process-live-p key)))))
|
||||
(setq value cached
|
||||
cache-used t))
|
||||
(tramp-message key 7 "%s %s; cache used: %s" property value cache-used)
|
||||
(unless (eq key tramp-cache-version)
|
||||
(tramp-message key 7 "%s %s; cache used: %s" property value cache-used))
|
||||
value))
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
@ -413,7 +414,8 @@ Return VALUE."
|
|||
(puthash property value hash))
|
||||
(setq tramp-cache-data-changed
|
||||
(or tramp-cache-data-changed (tramp-file-name-p key)))
|
||||
(tramp-message key 7 "%s %s" property value)
|
||||
(unless (eq key tramp-cache-version)
|
||||
(tramp-message key 7 "%s %s" property value))
|
||||
value)
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
|
|
@ -6382,12 +6382,10 @@ Convert file mode bits to string and set virtual device number.
|
|||
Set file uid and gid according to ID-FORMAT. LOCALNAME is used
|
||||
to cache the result. Return the modified ATTR."
|
||||
(declare (indent 3) (debug t))
|
||||
`(with-tramp-file-property
|
||||
,vec ,localname (format "file-attributes-%s" (or ,id-format 'integer))
|
||||
(when-let*
|
||||
((attr ,attr)
|
||||
(result
|
||||
(with-tramp-file-property ,vec ,localname "file-attributes"
|
||||
`(when-let*
|
||||
((result
|
||||
(with-tramp-file-property ,vec ,localname "file-attributes"
|
||||
(when-let* ((attr ,attr))
|
||||
(save-match-data
|
||||
;; Remove ANSI control escape sequences from symlink.
|
||||
(when (stringp (car attr))
|
||||
|
@ -6480,14 +6478,14 @@ to cache the result. Return the modified ATTR."
|
|||
(split-string (nth 12 attr) ":" 'omit)))
|
||||
;; Remove optional entries.
|
||||
(setcdr (nthcdr 11 attr) nil)
|
||||
attr))))
|
||||
attr)))))
|
||||
|
||||
;; Return normalized result.
|
||||
(append (tramp-compat-take 2 result)
|
||||
(if (eq ,id-format 'string)
|
||||
(list (car (nth 2 result)) (car (nth 3 result)))
|
||||
(list (cdr (nth 2 result)) (cdr (nth 3 result))))
|
||||
(nthcdr 4 result)))))
|
||||
;; Return normalized result.
|
||||
(append (tramp-compat-take 2 result)
|
||||
(if (eq ,id-format 'string)
|
||||
(list (car (nth 2 result)) (car (nth 3 result)))
|
||||
(list (cdr (nth 2 result)) (cdr (nth 3 result))))
|
||||
(nthcdr 4 result))))
|
||||
|
||||
(defun tramp-get-home-directory (vec &optional user)
|
||||
"The remote home directory for connection VEC as local file name.
|
||||
|
|
|
@ -158,6 +158,7 @@ being the result.")
|
|||
(when (cdr tramp--test-enabled-checked)
|
||||
;; Remove old test files.
|
||||
(dolist (dir `(,temporary-file-directory
|
||||
,tramp-compat-temporary-file-directory
|
||||
,ert-remote-temporary-file-directory))
|
||||
(dolist (file (directory-files dir 'full (rx bos (? ".#") "tramp-test")))
|
||||
(ignore-errors
|
||||
|
@ -5404,7 +5405,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
|
|||
direct-async-process-profile)
|
||||
connection-local-criteria-alist)))
|
||||
(skip-unless (tramp-direct-async-process-p))
|
||||
(when-let ((result (ert-test-most-recent-result ert-test)))
|
||||
(when-let* ((result (ert-test-most-recent-result ert-test)))
|
||||
(skip-unless (< (ert-test-result-duration result) 300)))
|
||||
;; We do expect an established connection already,
|
||||
;; `file-truename' does it by side-effect. Suppress
|
||||
|
@ -5944,7 +5945,9 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
|
||||
;; Test `async-shell-command-width'.
|
||||
(when (and (tramp--test-asynchronous-processes-p) (tramp--test-sh-p))
|
||||
(let* ((async-shell-command-width 1024)
|
||||
(let* (;; Since Fedora 41, this seems to be the upper limit. Used
|
||||
;; to be 1024 before.
|
||||
(async-shell-command-width 512)
|
||||
(default-directory ert-remote-temporary-file-directory)
|
||||
(cols (ignore-errors
|
||||
(read (tramp--test-shell-command-to-string-asynchronously
|
||||
|
@ -6464,6 +6467,7 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
(tmp-name1 (tramp--test-make-temp-name nil quoted))
|
||||
(tmp-name2 (expand-file-name "foo" tmp-name1))
|
||||
(tramp-remote-process-environment tramp-remote-process-environment)
|
||||
;; Suppress nasty messages.
|
||||
(inhibit-message t)
|
||||
(vc-handled-backends
|
||||
(cond
|
||||
|
@ -6486,9 +6490,7 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
(tramp-cleanup-connection
|
||||
tramp-test-vec 'keep-debug 'keep-password)
|
||||
'(Bzr))
|
||||
(t nil)))
|
||||
;; Suppress nasty messages.
|
||||
(inhibit-message t))
|
||||
(t nil))))
|
||||
(skip-unless vc-handled-backends)
|
||||
(unless quoted (tramp--test-message "%s" vc-handled-backends))
|
||||
|
||||
|
@ -8258,7 +8260,6 @@ If INTERACTIVE is non-nil, the tests are run interactively."
|
|||
;; * file-equal-p (partly done in `tramp-test21-file-links')
|
||||
;; * file-in-directory-p
|
||||
;; * file-name-case-insensitive-p
|
||||
;; * memory-info
|
||||
;; * tramp-get-home-directory
|
||||
;; * tramp-set-file-uid-gid
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue