Sync with Tramp 2.6.3-pre (don't merge with master)

* doc/misc/tramp.texi (Obtaining @value{tramp}): Mention the ELPA
Tramp manual.
(Remote processes): Adapt index.

* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.3-pre".

* lisp/net/tramp.el (tramp-local-host-regexp): Extend.  Adapt :version.
(tramp-signal-process): PROCESS can also be a string.
(tramp-skeleton-directory-files):
* lisp/net/tramp-cache.el (with-tramp-saved-file-property)
(with-tramp-saved-file-properties)
(with-tramp-saved-connection-property)
(with-tramp-saved-connection-properties): Use `setf' but `setq' in macro.

* lisp/net/tramp-compat.el (tramp-compat-funcall): Declare debug.

* lisp/net/tramp-crypt.el (tramp-crypt-file-name-p): Exclude lock files.
(tramp-crypt-file-name-handler-alist): Use `identity' for
`abbreviate-file-name'.
(tramp-crypt-add-directory, tramp-crypt-remove-directory):
Adapt docstrings.
(tramp-crypt-cleanup-connection): New defun.  Add it to
`tramp-cleanup-connection-hook'

* lisp/net/tramp.el (tramp-skeleton-file-name-all-completions):
Handle "." and "..".

* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
Remove special handling of "." an "..".

* lisp/net/tramp-sh.el (tramp-pipe-stty-settings): New defcustom.
(tramp-sh-handle-make-process): Use it.  (Bug#62093)

* test/lisp/net/tramp-tests.el (tramp-test18-file-attributes):
Adapt test.
(tramp-test31-signal-process): Extend.
This commit is contained in:
Michael Albinus 2024-01-20 10:45:27 +01:00
parent 3a541b25df
commit 115908469d
12 changed files with 157 additions and 98 deletions

View file

@ -318,7 +318,7 @@ behind the scenes when you open a file with @value{tramp}.
@cindex GNU ELPA @cindex GNU ELPA
@vindex tramp-version @vindex tramp-version
@value{tramp} is included as part of Emacs (since @w{Emacs 22.1}). @value{tramp} is included as part of Emacs.
@value{tramp} is also freely packaged for download on the Internet at @value{tramp} is also freely packaged for download on the Internet at
@uref{https://ftp.gnu.org/gnu/tramp/}. The version number of @uref{https://ftp.gnu.org/gnu/tramp/}. The version number of
@ -340,10 +340,12 @@ versions packaged with Emacs can be retrieved by
@end lisp @end lisp
@value{tramp} is also available as @uref{https://elpa.gnu.org, GNU @value{tramp} is also available as @uref{https://elpa.gnu.org, GNU
ELPA} package. Besides the standalone releases, further minor versions ELPA} package. Besides the standalone releases, further minor
of @value{tramp} will appear on GNU ELPA, until the next @value{tramp} versions of @value{tramp} will appear on GNU ELPA, until the next
release appears. These minor versions have a four-number string, like @value{tramp} release appears. These minor versions have a
``2.4.5.1''. four-number string, like ``2.4.5.1''. The manual of the latest
@value{tramp} ELPA package is located at
@uref{https://elpa.gnu.org/packages/doc/tramp.html}.
@value{tramp} development versions are available on Git servers. @value{tramp} development versions are available on Git servers.
Development versions contain new and incomplete features. The Development versions contain new and incomplete features. The
@ -4108,7 +4110,7 @@ To open @command{powershell} as a remote shell, use this:
@subsection Remote process connection type @subsection Remote process connection type
@vindex process-connection-type @vindex process-connection-type
@cindex tramp-process-connection-type @vindex tramp-process-connection-type
Asynchronous processes behave differently based on whether they use a Asynchronous processes behave differently based on whether they use a
pseudo tty or not. This is controlled by the variable pseudo tty or not. This is controlled by the variable
@ -4245,7 +4247,7 @@ called @code{tramp-connection-local-*-ps-profile} and
@end group @end group
@end lisp @end lisp
@cindex proced @cindex @code{proced}
@vindex proced-show-remote-processes @vindex proced-show-remote-processes
If you want to see a listing of remote system processes when calling If you want to see a listing of remote system processes when calling
@code{proced}, set user option @code{proced-show-remote-processes} to @code{proced}, set user option @code{proced-show-remote-processes} to

View file

@ -7,7 +7,7 @@
@c In the Tramp GIT, the version number and the bug report address @c In the Tramp GIT, the version number and the bug report address
@c are auto-frobbed from configure.ac. @c are auto-frobbed from configure.ac.
@set trampver 2.6.2.29.2 @set trampver 2.6.3-pre
@set trampurl https://www.gnu.org/software/tramp/ @set trampurl https://www.gnu.org/software/tramp/
@set tramp-bug-report-address tramp-devel@@gnu.org @set tramp-bug-report-address tramp-devel@@gnu.org
@set emacsver 26.1 @set emacsver 26.1

View file

@ -464,14 +464,10 @@ Emacs dired can't find files."
(file-name-as-directory f) (file-name-as-directory f)
f)) f))
(with-current-buffer (tramp-get-buffer v) (with-current-buffer (tramp-get-buffer v)
(append (mapcar
;; On some file systems like "sdcard", "." and ".." are (lambda (l)
;; not included. (and (not (string-match-p (rx bol (* blank) eol) l)) l))
'("." "..") (split-string (buffer-string) "\n" 'omit)))))))))
(mapcar
(lambda (l)
(and (not (string-match-p (rx bol (* blank) eol) l)) l))
(split-string (buffer-string) "\n" 'omit))))))))))
(defun tramp-adb-handle-file-local-copy (filename) (defun tramp-adb-handle-file-local-copy (filename)
"Like `file-local-copy' for Tramp files." "Like `file-local-copy' for Tramp files."

View file

@ -338,7 +338,7 @@ Preserve timestamps."
(declare (indent 3) (debug t)) (declare (indent 3) (debug t))
`(progn `(progn
;; Unify localname. Remove hop from `tramp-file-name' structure. ;; Unify localname. Remove hop from `tramp-file-name' structure.
(setq ,key (tramp-file-name-unify ,key ,file)) (setf ,key (tramp-file-name-unify ,key ,file))
(let* ((hash (tramp-get-hash-table ,key)) (let* ((hash (tramp-get-hash-table ,key))
(cached (and (hash-table-p hash) (gethash ,property hash)))) (cached (and (hash-table-p hash) (gethash ,property hash))))
(unwind-protect (progn ,@body) (unwind-protect (progn ,@body)
@ -356,7 +356,7 @@ Preserve timestamps."
(declare (indent 3) (debug t)) (declare (indent 3) (debug t))
`(progn `(progn
;; Unify localname. Remove hop from `tramp-file-name' structure. ;; Unify localname. Remove hop from `tramp-file-name' structure.
(setq ,key (tramp-file-name-unify ,key ,file)) (setf ,key (tramp-file-name-unify ,key ,file))
(let* ((hash (tramp-get-hash-table ,key)) (let* ((hash (tramp-get-hash-table ,key))
(values (values
(and (hash-table-p hash) (and (hash-table-p hash)
@ -472,7 +472,7 @@ used to cache connection properties of the local machine."
"Save PROPERTY, run BODY, reset PROPERTY." "Save PROPERTY, run BODY, reset PROPERTY."
(declare (indent 2) (debug t)) (declare (indent 2) (debug t))
`(progn `(progn
(setq ,key (tramp-file-name-unify ,key)) (setf ,key (tramp-file-name-unify ,key))
(let* ((hash (tramp-get-hash-table ,key)) (let* ((hash (tramp-get-hash-table ,key))
(cached (and (hash-table-p hash) (cached (and (hash-table-p hash)
(gethash ,property hash tramp-cache-undefined)))) (gethash ,property hash tramp-cache-undefined))))
@ -489,7 +489,7 @@ used to cache connection properties of the local machine."
PROPERTIES is a list of file properties (strings)." PROPERTIES is a list of file properties (strings)."
(declare (indent 2) (debug t)) (declare (indent 2) (debug t))
`(progn `(progn
(setq ,key (tramp-file-name-unify ,key)) (setf ,key (tramp-file-name-unify ,key))
(let* ((hash (tramp-get-hash-table ,key)) (let* ((hash (tramp-get-hash-table ,key))
(values (values
(mapcar (mapcar

View file

@ -63,6 +63,7 @@
;; avoid them in cases we know what we do. ;; avoid them in cases we know what we do.
(defmacro tramp-compat-funcall (function &rest arguments) (defmacro tramp-compat-funcall (function &rest arguments)
"Call FUNCTION with ARGUMENTS if it exists. Do not raise compiler warnings." "Call FUNCTION with ARGUMENTS if it exists. Do not raise compiler warnings."
(declare (indent 1) (debug t))
`(when (functionp ,function) `(when (functionp ,function)
(with-no-warnings (funcall ,function ,@arguments)))) (with-no-warnings (funcall ,function ,@arguments))))

View file

@ -148,6 +148,8 @@ If NAME doesn't belong to an encrypted remote directory, return nil."
(and tramp-crypt-enabled (stringp name) (and tramp-crypt-enabled (stringp name)
(not (tramp-compat-file-name-quoted-p name)) (not (tramp-compat-file-name-quoted-p name))
(not (string-suffix-p tramp-crypt-encfs-config name)) (not (string-suffix-p tramp-crypt-encfs-config name))
;; No lock file name.
(not (string-prefix-p ".#" (file-name-nondirectory name)))
(dolist (dir tramp-crypt-directories) (dolist (dir tramp-crypt-directories)
(and (string-prefix-p (and (string-prefix-p
dir (file-name-as-directory (expand-file-name name))) dir (file-name-as-directory (expand-file-name name)))
@ -157,7 +159,7 @@ If NAME doesn't belong to an encrypted remote directory, return nil."
;; New handlers should be added here. ;; New handlers should be added here.
;;;###tramp-autoload ;;;###tramp-autoload
(defconst tramp-crypt-file-name-handler-alist (defconst tramp-crypt-file-name-handler-alist
'(;; `abbreviate-file-name' performed by default handler. '((abbreviate-file-name . identity)
(access-file . tramp-crypt-handle-access-file) (access-file . tramp-crypt-handle-access-file)
(add-name-to-file . tramp-handle-add-name-to-file) (add-name-to-file . tramp-handle-add-name-to-file)
;; `byte-compiler-base-file-name' performed by default handler. ;; `byte-compiler-base-file-name' performed by default handler.
@ -487,7 +489,7 @@ See `tramp-crypt-do-encrypt-or-decrypt-file'."
;;;###tramp-autoload ;;;###tramp-autoload
(defun tramp-crypt-add-directory (name) (defun tramp-crypt-add-directory (name)
"Mark remote directory NAME for encryption. "Mark expanded remote directory NAME for encryption.
Files in that directory and all subdirectories will be encrypted Files in that directory and all subdirectories will be encrypted
before copying to, and decrypted after copying from that before copying to, and decrypted after copying from that
directory. File names will be also encrypted." directory. File names will be also encrypted."
@ -511,7 +513,7 @@ directory. File names will be also encrypted."
#'tramp-crypt-command-completion-p) #'tramp-crypt-command-completion-p)
(defun tramp-crypt-remove-directory (name) (defun tramp-crypt-remove-directory (name)
"Unmark remote directory NAME for encryption. "Unmark expanded remote directory NAME for encryption.
Existing files in that directory and its subdirectories will be Existing files in that directory and its subdirectories will be
kept in their encrypted form." kept in their encrypted form."
;; (declare (completion tramp-crypt-command-completion-p)) ;; (declare (completion tramp-crypt-command-completion-p))
@ -859,6 +861,22 @@ WILDCARD is not supported."
(tramp-compat-funcall (tramp-compat-funcall
'unlock-file (tramp-crypt-encrypt-file-name filename)))) 'unlock-file (tramp-crypt-encrypt-file-name filename))))
(defun tramp-crypt-cleanup-connection (vec)
"Cleanup crypt ressources determined by VEC."
(let ((tramp-cleanup-connection-hook
(remove
#'tramp-crypt-cleanup-connection tramp-cleanup-connection-hook)))
(dolist (dir tramp-crypt-directories)
(when (tramp-file-name-equal-p vec (tramp-dissect-file-name dir))
(tramp-cleanup-connection (tramp-crypt-dissect-file-name dir))))))
;; Add cleanup hooks.
(add-hook 'tramp-cleanup-connection-hook #'tramp-crypt-cleanup-connection)
(add-hook 'tramp-crypt-unload-hook
(lambda ()
(remove-hook 'tramp-cleanup-connection-hook
#'tramp-crypt-cleanup-connection)))
(with-eval-after-load 'bookmark (with-eval-after-load 'bookmark
(add-hook 'bookmark-inhibit-context-functions (add-hook 'bookmark-inhibit-context-functions
#'tramp-crypt-file-name-p) #'tramp-crypt-file-name-p)

View file

@ -108,17 +108,8 @@
(tramp-fuse-remove-hidden-files (tramp-fuse-remove-hidden-files
(all-completions (all-completions
filename filename
(append (file-name-all-completions
(file-name-all-completions filename (tramp-fuse-local-file-name directory))))))
filename (tramp-fuse-local-file-name directory))
;; Some storage systems do not return "." and "..".
(let (result)
(dolist (item '(".." ".") result)
(when (string-prefix-p filename item)
(catch 'match
(dolist (elt completion-regexp-list)
(unless (string-match-p elt item) (throw 'match nil)))
(setq result (cons (concat item "/") result)))))))))))
;; This function isn't used. ;; This function isn't used.
(defun tramp-fuse-handle-insert-directory (defun tramp-fuse-handle-insert-directory

View file

@ -1440,7 +1440,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
filename filename
(with-parsed-tramp-file-name (expand-file-name directory) nil (with-parsed-tramp-file-name (expand-file-name directory) nil
(with-tramp-file-property v localname "file-name-all-completions" (with-tramp-file-property v localname "file-name-all-completions"
(let ((result '("./" "../"))) (let (result)
;; Get a list of directories and files. ;; Get a list of directories and files.
(dolist (item (dolist (item
(tramp-gvfs-get-directory-attributes directory) (tramp-gvfs-get-directory-attributes directory)

View file

@ -2876,7 +2876,16 @@ the result will be a local, non-Tramp, file name."
(tramp-run-real-handler (tramp-run-real-handler
#'expand-file-name (list localname)))))))))) #'expand-file-name (list localname))))))))))
;;; Remote commands: ;;; Remote processes:
(defcustom tramp-pipe-stty-settings "-icanon min 1 time 0"
"How to prevent blocking read in pipeline processes.
This is used in `make-process' with `connection-type' `pipe'."
:group 'tramp
:version "29.3"
:type '(choice (const :tag "Use size limit" "-icanon min 1 time 0")
(const :tag "Use timeout" "-icanon min 0 time 1")
string))
;; We use BUFFER also as connection buffer during setup. Because of ;; We use BUFFER also as connection buffer during setup. Because of
;; this, its original contents must be saved, and restored once ;; this, its original contents must be saved, and restored once
@ -3087,12 +3096,21 @@ implementation will be used."
;; otherwise strings larger than 4096 ;; otherwise strings larger than 4096
;; bytes, sent by the process, could ;; bytes, sent by the process, could
;; block, see termios(3) and Bug#61341. ;; block, see termios(3) and Bug#61341.
;; In order to prevent blocking read
;; from pipe processes, "stty -icanon"
;; is used. By default, it expects at
;; least one character to read. When a
;; process does not read from stdin,
;; like magit, it should set a timeout
;; instead. See`tramp-pipe-stty-settings'.
;; (Bug#62093)
;; FIXME: Shall we rather use "stty raw"? ;; FIXME: Shall we rather use "stty raw"?
(if (tramp-check-remote-uname v "Darwin") (tramp-send-command
(tramp-send-command v (format
v "stty -icanon min 1 time 0") "stty %s %s"
(tramp-send-command (if (tramp-check-remote-uname v "Darwin")
v "stty -icrnl -icanon min 1 time 0"))) "" "-icrnl")
tramp-pipe-stty-settings)))
;; `tramp-maybe-open-connection' and ;; `tramp-maybe-open-connection' and
;; `tramp-send-command-and-read' could ;; `tramp-send-command-and-read' could
;; have trashed the connection buffer. ;; have trashed the connection buffer.

View file

@ -569,11 +569,15 @@ host runs a restricted shell, it shall be added to this list, too."
(tramp-compat-rx (tramp-compat-rx
bos bos
(| (literal tramp-system-name) (| (literal tramp-system-name)
(| "localhost" "localhost4" "localhost6" "127.0.0.1" "::1")) (| "localhost" "127.0.0.1" "::1"
;; Fedora.
"localhost4" "localhost6"
;; Ubuntu.
"ip6-localhost" "ip6-loopback"))
eos) eos)
"Host names which are regarded as local host. "Host names which are regarded as local host.
If the local host runs a chrooted environment, set this to nil." If the local host runs a chrooted environment, set this to nil."
:version "29.1" :version "29.3"
:type '(choice (const :tag "Chrooted environment" nil) :type '(choice (const :tag "Chrooted environment" nil)
(regexp :tag "Host regexp"))) (regexp :tag "Host regexp")))
@ -3071,19 +3075,27 @@ not in completion mode."
(tramp-run-real-handler #'file-exists-p (list filename)))) (tramp-run-real-handler #'file-exists-p (list filename))))
(defmacro tramp-skeleton-file-name-all-completions (defmacro tramp-skeleton-file-name-all-completions
(_filename _directory &rest body) (filename directory &rest body)
"Skeleton for `tramp-*-handle-filename-all-completions'. "Skeleton for `tramp-*-handle-filename-all-completions'.
BODY is the backend specific code." BODY is the backend specific code."
(declare (indent 2) (debug t)) (declare (indent 2) (debug t))
`(tramp-compat-ignore-error file-missing `(tramp-compat-ignore-error file-missing
(delete-dups (delq nil (delete-dups (delq nil
(let* ((case-fold-search read-file-name-completion-ignore-case) (let* ((case-fold-search read-file-name-completion-ignore-case)
(regexp (mapconcat #'identity completion-regexp-list "\\|")) (result (progn ,@body)))
(result ,@body)) ;; Some storage systems do not return "." and "..".
(when (tramp-tramp-file-p ,directory)
(dolist (elt '(".." "."))
(when (string-prefix-p ,filename elt)
(setq result (cons (concat elt "/") result)))))
(if (consp completion-regexp-list) (if (consp completion-regexp-list)
;; Discriminate over `completion-regexp-list'. ;; Discriminate over `completion-regexp-list'.
(mapcar (mapcar
(lambda (x) (and (stringp x) (string-match-p regexp x) x)) (lambda (x)
(when (stringp x)
(catch 'match
(dolist (elt completion-regexp-list x)
(unless (string-match-p elt x) (throw 'match nil))))))
result) result)
result)))))) result))))))
@ -3617,7 +3629,7 @@ BODY is the backend specific code."
(with-parsed-tramp-file-name (expand-file-name ,directory) nil (with-parsed-tramp-file-name (expand-file-name ,directory) nil
(tramp-barf-if-file-missing v ,directory (tramp-barf-if-file-missing v ,directory
(when (file-directory-p ,directory) (when (file-directory-p ,directory)
(setq ,directory (setf ,directory
(file-name-as-directory (expand-file-name ,directory))) (file-name-as-directory (expand-file-name ,directory)))
(let ((temp (let ((temp
(with-tramp-file-property v localname "directory-files" ,@body)) (with-tramp-file-property v localname "directory-files" ,@body))
@ -6895,7 +6907,14 @@ If PROCESS is a process object which contains the property
`remote-pid', or PROCESS is a number and REMOTE is a remote file name, `remote-pid', or PROCESS is a number and REMOTE is a remote file name,
PROCESS is interpreted as process on the respective remote host, which PROCESS is interpreted as process on the respective remote host, which
will be the process to signal. will be the process to signal.
If PROCESS is a string, it is interpreted as process object with
the respective process name, or as a number.
SIGCODE may be an integer, or a symbol whose name is a signal name." SIGCODE may be an integer, or a symbol whose name is a signal name."
(when (stringp process)
(setq process (or (get-process process)
(and (string-match-p (rx bol (+ digit) eol) process)
(string-to-number process))
(signal 'wrong-type-argument (list #'processp process)))))
(let (pid vec) (let (pid vec)
(cond (cond
((processp process) ((processp process)

View file

@ -7,7 +7,7 @@
;; Maintainer: Michael Albinus <michael.albinus@gmx.de> ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes ;; Keywords: comm, processes
;; Package: tramp ;; Package: tramp
;; Version: 2.6.2.29.2 ;; Version: 2.6.3-pre
;; Package-Requires: ((emacs "26.1")) ;; Package-Requires: ((emacs "26.1"))
;; Package-Type: multi ;; Package-Type: multi
;; URL: https://www.gnu.org/software/tramp/ ;; URL: https://www.gnu.org/software/tramp/
@ -40,7 +40,7 @@
;; ./configure" to change them. ;; ./configure" to change them.
;;;###tramp-autoload ;;;###tramp-autoload
(defconst tramp-version "2.6.2.29.2" (defconst tramp-version "2.6.3-pre"
"This version of Tramp.") "This version of Tramp.")
;;;###tramp-autoload ;;;###tramp-autoload
@ -78,7 +78,7 @@
;; Check for Emacs version. ;; Check for Emacs version.
(let ((x (if (not (string-version-lessp emacs-version "26.1")) (let ((x (if (not (string-version-lessp emacs-version "26.1"))
"ok" "ok"
(format "Tramp 2.6.2.29.2 is not fit for %s" (format "Tramp 2.6.3-pre is not fit for %s"
(replace-regexp-in-string "\n" "" (emacs-version)))))) (replace-regexp-in-string "\n" "" (emacs-version))))))
(unless (string-equal "ok" x) (error "%s" x))) (unless (string-equal "ok" x) (error "%s" x)))

View file

@ -3757,7 +3757,7 @@ This tests also `access-file', `file-readable-p',
(should (eq (file-attribute-type attr) t))) (should (eq (file-attribute-type attr) t)))
;; Cleanup. ;; Cleanup.
(ignore-errors (delete-directory tmp-name1)) (ignore-errors (delete-directory tmp-name1 'recursive))
(ignore-errors (delete-file tmp-name1)) (ignore-errors (delete-file tmp-name1))
(ignore-errors (delete-file tmp-name2)))))) (ignore-errors (delete-file tmp-name2))))))
@ -5675,55 +5675,69 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
(delete-exited-processes t) (delete-exited-processes t)
kill-buffer-query-functions command proc) kill-buffer-query-functions command proc)
(dolist (sigcode '(2 INT)) ;; If PROCESS is a string, it must be a process name or a process
(unwind-protect ;; number. Check error handling.
(with-temp-buffer (should-error
(setq command "trap 'echo boom; exit 1' 2; sleep 100" (signal-process (md5 (current-time-string)) 0)
proc (start-file-process-shell-command :type 'wrong-type-argument)
(format "test1%s" sigcode) (current-buffer) command))
(should (processp proc))
(should (process-live-p proc))
(should (equal (process-status proc) 'run))
(should (numberp (process-get proc 'remote-pid)))
(should (equal (process-get proc 'remote-command)
(with-connection-local-variables
`(,shell-file-name ,shell-command-switch ,command))))
(should (zerop (signal-process proc sigcode)))
;; Let the process accept the signal.
(with-timeout (10 (tramp--test-timeout-handler))
(while (accept-process-output proc 0 nil t)))
(should-not (process-live-p proc)))
;; Cleanup. ;; The PROCESS argument of `signal-process' can be a string. Test
(ignore-errors (kill-process proc)) ;; this as well.
(ignore-errors (delete-process proc))) (dolist
(func '(identity
(unwind-protect (lambda (x) (format "%s" (if (processp x) (process-name x) x)))))
(with-temp-buffer (dolist (sigcode '(2 INT))
(setq command "trap 'echo boom; exit 1' 2; sleep 100" (unwind-protect
proc (start-file-process-shell-command (with-temp-buffer
(format "test2%s" sigcode) (current-buffer) command)) (setq command "trap 'echo boom; exit 1' 2; sleep 100"
(should (processp proc)) proc (start-file-process-shell-command
(should (process-live-p proc)) (format "test1-%s" sigcode) (current-buffer) command))
(should (equal (process-status proc) 'run)) (should (processp proc))
(should (numberp (process-get proc 'remote-pid))) (should (process-live-p proc))
(should (equal (process-get proc 'remote-command) (should (equal (process-status proc) 'run))
(with-connection-local-variables (should (numberp (process-get proc 'remote-pid)))
`(,shell-file-name ,shell-command-switch ,command))))
;; `signal-process' has argument REMOTE since Emacs 29.
(with-no-warnings
(should (should
(zerop (equal (process-get proc 'remote-command)
(signal-process (with-connection-local-variables
(process-get proc 'remote-pid) sigcode default-directory)))) `(,shell-file-name ,shell-command-switch ,command))))
;; Let the process accept the signal. (should (zerop (signal-process (funcall func proc) sigcode)))
(with-timeout (10 (tramp--test-timeout-handler)) ;; Let the process accept the signal.
(while (accept-process-output proc 0 nil t))) (with-timeout (10 (tramp--test-timeout-handler))
(should-not (process-live-p proc))) (while (accept-process-output proc 0 nil t)))
(should-not (process-live-p proc)))
;; Cleanup. ;; Cleanup.
(ignore-errors (kill-process proc)) (ignore-errors (kill-process proc))
(ignore-errors (delete-process proc)))))) (ignore-errors (delete-process proc)))
(unwind-protect
(with-temp-buffer
(setq command "trap 'echo boom; exit 1' 2; sleep 100"
proc (start-file-process-shell-command
(format "test2-%s" sigcode) (current-buffer) command))
(should (processp proc))
(should (process-live-p proc))
(should (equal (process-status proc) 'run))
(should (numberp (process-get proc 'remote-pid)))
(should
(equal (process-get proc 'remote-command)
(with-connection-local-variables
`(,shell-file-name ,shell-command-switch ,command))))
;; `signal-process' has argument REMOTE since Emacs 29.
(with-no-warnings
(should
(zerop
(signal-process
(funcall func (process-get proc 'remote-pid))
sigcode default-directory))))
;; Let the process accept the signal.
(with-timeout (10 (tramp--test-timeout-handler))
(while (accept-process-output proc 0 nil t)))
(should-not (process-live-p proc)))
;; Cleanup.
(ignore-errors (kill-process proc))
(ignore-errors (delete-process proc)))))))
(ert-deftest tramp-test31-list-system-processes () (ert-deftest tramp-test31-list-system-processes ()
"Check `list-system-processes'." "Check `list-system-processes'."