Some Tramp fixes, resulting from test campaign

* doc/misc/tramp.texi (Remote shell setup): Clarifications for
`tramp-actions-before-shell' example.

* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Do not expand
FILENAME explicitely.
(tramp-open-shell): Add "-i" for interactive shells.

* test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p)
(tramp-test14-delete-directory)
(tramp-test43-asynchronous-requests): Skip for MS windows.
This commit is contained in:
Michael Albinus 2021-01-19 18:45:55 +01:00
parent deb90c893d
commit f3b9d5b315
3 changed files with 22 additions and 16 deletions

View file

@ -2369,8 +2369,7 @@ that can identify such questions using
@lisp
@group
(defconst my-tramp-prompt-regexp
(concat (regexp-opt '("Enter the birth date of your mother:") t)
"\\s-*")
"Enter the birth date of your mother:\\s-*"
"Regular expression matching my login prompt question.")
@end group
@ -2389,6 +2388,11 @@ that can identify such questions using
@end group
@end lisp
The regular expressions used in @code{tramp-actions-before-shell} must
match the end of the connection buffer. Due to performance reasons,
this search starts at the end of the buffer, and it is limited to 256
characters backwards.
@item Conflicting names for users and variables in @file{.profile}

View file

@ -2608,12 +2608,11 @@ The method used must be an out-of-band method."
(defun tramp-sh-handle-insert-directory
(filename switches &optional wildcard full-directory-p)
"Like `insert-directory' for Tramp files."
(setq filename (expand-file-name filename))
(unless switches (setq switches ""))
;; Check, whether directory is accessible.
(unless wildcard
(access-file filename "Reading directory"))
(with-parsed-tramp-file-name filename nil
(with-parsed-tramp-file-name (expand-file-name filename) nil
(if (and (featurep 'ls-lisp)
(not (symbol-value 'ls-lisp-use-insert-directory-program)))
(tramp-handle-insert-directory
@ -4306,11 +4305,14 @@ file exists and nonzero exit status otherwise."
;; ensure they have the correct values when the shell starts, not
;; just processes run within the shell. (Which processes include
;; our initial probes to ensure the remote shell is usable.)
;; For the time being, we assume that all shells interpret -i as
;; interactive shell. Must be the last argument, because (for
;; example) bash expects long options first.
(tramp-send-command
vec (format
(concat
"exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' "
"ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s")
"ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s -i")
tramp-terminal-type
(or (getenv "INSIDE_EMACS") emacs-version) tramp-version
(or (getenv-internal "ENV" tramp-remote-process-environment) "")

View file

@ -2272,8 +2272,8 @@ This checks also `file-name-as-directory', `file-name-directory',
(delete-file tmp-name)
(should-not (file-exists-p tmp-name))
;; Trashing files doesn't work for crypted remote files.
(unless (tramp--test-crypt-p)
;; Trashing files doesn't work on MS Windows, and for crypted remote files.
(unless (or (tramp--test-windows-nt-p) (tramp--test-crypt-p))
(let ((trash-directory (tramp--test-make-temp-name 'local quoted))
(delete-by-moving-to-trash t))
(make-directory trash-directory)
@ -2786,9 +2786,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
(should-not (file-directory-p tmp-name1))
;; Trashing directories works only since Emacs 27.1. It doesn't
;; work for crypted remote directories and for ange-ftp.
(when (and (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p))
(tramp--test-emacs27-p))
;; work on MS Windows, for crypted remote directories and for ange-ftp.
(when (and (not (tramp--test-windows-nt-p)) (not (tramp--test-crypt-p))
(not (tramp--test-ftp-p)) (tramp--test-emacs27-p))
(let ((trash-directory (tramp--test-make-temp-name 'local quoted))
(delete-by-moving-to-trash t))
(make-directory trash-directory)
@ -6349,6 +6349,7 @@ process sentinels. They shall not disturb each other."
(tramp--test-sh-p)))
(skip-unless (not (tramp--test-crypt-p)))
(skip-unless (not (tramp--test-docker-p)))
(skip-unless (not (tramp--test-windows-nt-p)))
(with-timeout
(tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler))
@ -6358,12 +6359,11 @@ process sentinels. They shall not disturb each other."
(shell-file-name (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh"))
;; It doesn't work on w32 systems.
(watchdog
(unless (tramp--test-windows-nt-p)
(start-process-shell-command
"*watchdog*" nil
(format
"sleep %d; kill -USR1 %d"
tramp--test-asynchronous-requests-timeout (emacs-pid)))))
(start-process-shell-command
"*watchdog*" nil
(format
"sleep %d; kill -USR1 %d"
tramp--test-asynchronous-requests-timeout (emacs-pid))))
(tmp-name (tramp--test-make-temp-name))
(default-directory tmp-name)
;; Do not cache Tramp properties.