Document and test process filters in tramp-smb.el

* doc/misc/tramp.texi (Remote processes): Provide more details in
"Running remote processes on MS Windows hosts".

* test/lisp/net/tramp-tests.el (tramp-test29-start-file-process)
(tramp-test30-make-process): Adapt tests.
This commit is contained in:
Michael Albinus 2025-12-16 18:33:56 +01:00
parent 62ce890c9f
commit 645a6ba081
2 changed files with 42 additions and 38 deletions

View file

@ -4501,21 +4501,6 @@ remote MS Windows host, and @value{tramp} uses it for
@code{make-process}, @code{process-file} and
@code{start-file-process}. It does not work for remote Samba servers.
Redirection from stdin and process filters are not supported (yet).
Check, that the default remote temporary file directory is usable.
Otherwise, change it, for example (with adapted @t{"user"} and
@t{"host"}):
@lisp
(add-to-list 'tramp-connection-properties
(list (regexp-quote "host")
"tmpdir" "/Users/user/AppData/Local/Temp"))
@end lisp
@noindent
@xref{Predefined connection information}.
@c FIXME: Verify powershell version.
@vindex tramp-smb-winexe-program
@code{tramp-smb-winexe-program} specifies the local @command{winexe}
@ -4533,6 +4518,26 @@ achieved by creating the
@samp{HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ LocalAccountTokenFilterPolicy}
parameter in the MS Windows registry as DWORD (32-bit) with the value 1.
Check, that the default remote temporary file directory is usable.
Otherwise, change it, for example (with adapted @t{"user"} and
@t{"host"}):
@lisp
(add-to-list 'tramp-connection-properties
(list (regexp-quote "host")
"tmpdir" "/Users/user/AppData/Local/Temp"))
@end lisp
@noindent
@xref{Predefined connection information}.
Redirection from stdin is not supported.
@vindex auto-revert-remote-files
If you use a remote asynchronous process with a separate error buffer,
you must ensure that remote files can be auto-reverted. Set user
option @code{auto-revert-remote-files} to a non-@code{nil} value.
@vindex tramp-smb-connection-local-powershell-profile
@vindex tramp-smb-prompt
@cindex @file{.emacs_powershell} file

View file

@ -5512,6 +5512,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
kill-buffer-query-functions command proc)
;; Simple process.
;; The "smb" method does not support stdin redirection.
(unless (tramp--test-smb-p)
(unwind-protect
(with-temp-buffer
@ -5561,11 +5562,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(delete-file tmp-name)))
;; Process filter.
;; FIXME: tramp-smb.el should implement this.
(unless (tramp--test-smb-p)
(unwind-protect
(with-temp-buffer
(setq command '("cat")
(setq command '("echo" "foo")
proc
(apply #'start-file-process "test3" (current-buffer) command))
(should (processp proc))
@ -5573,17 +5572,19 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (equal (process-get proc 'remote-command) command))
(set-process-filter
proc
(lambda (p s) (with-current-buffer (process-buffer p) (insert s))))
(process-send-string proc "foo\n")
(process-send-eof proc)
(lambda (p s)
(with-current-buffer
(process-buffer p)
(insert
(replace-regexp-in-string (rx bol "foo" eol) "foobar" s)))))
;; Read output.
(with-timeout (10 (tramp--test-timeout-handler))
(while (< (- (point-max) (point-min)) (length "foo"))
(while (not (string-match-p "foobar" (buffer-string)))
(while (accept-process-output proc 0 nil t))))
(should (string-match-p "foo" (buffer-string))))
(should (string-match-p "foobar" (buffer-string))))
;; Cleanup.
(ignore-errors (delete-process proc))))
(ignore-errors (delete-process proc)))
;; Disabled process filter. It doesn't work reliable.
(unless t
@ -5709,10 +5710,12 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
(let ((default-directory ert-remote-temporary-file-directory)
(tmp-name (tramp--test-make-temp-name nil quoted))
(inhibit-message (not (ignore-errors (edebug-mode))))
kill-buffer-query-functions command proc)
(should-not (apply #'make-process nil)) ; Use `apply' to avoid warnings.
;; Simple process.
;; The "smb" method does not support stdin redirection.
(unless (tramp--test-smb-p)
(unwind-protect
(with-temp-buffer
@ -5765,31 +5768,31 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
(delete-file tmp-name)))
;; Process filter.
;; FIXME: tramp-smb.el should implement this.
(unless (tramp--test-smb-p)
(unwind-protect
(with-temp-buffer
(setq command '("cat")
(setq command '("echo" "foo")
proc
(make-process
:name "test3" :buffer (current-buffer) :command command
:filter
(lambda (p s)
(with-current-buffer (process-buffer p) (insert s)))
(with-current-buffer
(process-buffer p)
(insert
(replace-regexp-in-string
(rx bol "foo" eol) "foobar" s))))
:file-handler t))
(should (processp proc))
(should (equal (process-status proc) 'run))
(should (equal (process-get proc 'remote-command) command))
(process-send-string proc "foo\n")
(process-send-eof proc)
;; Read output.
(with-timeout (10 (tramp--test-timeout-handler))
(while (not (string-match-p "foo" (buffer-string)))
(while (not (string-match-p "foobar" (buffer-string)))
(while (accept-process-output proc 0 nil t))))
(should (string-match-p "foo" (buffer-string))))
(should (string-match-p "foobar" (buffer-string))))
;; Cleanup.
(ignore-errors (delete-process proc))))
(ignore-errors (delete-process proc)))
;; Disabled process filter. It doesn't work reliable.
(unless t
@ -9016,11 +9019,7 @@ If INTERACTIVE is non-nil, the tests are run interactively."
;; * Implement `tramp-test31-interrupt-process' and
;; `tramp-test31-signal-process' for "adb", "sshfs" and for direct
;; async processes. Check, why they don't run stable.
;; * Fix the limitations for "smb" in `tramp-test28-process-file',
;; `tramp-test29-start-file-process', `tramp-test30-make-process',
;; `tramp-test32-shell-command',
;; `tramp-test34-explicit-shell-file-name' and
;; `tramp--test-check-files'.
;; * Fix the limitations for "smb" in `tramp--test-check-files'.
;; * Check, why `tramp-test45-asynchronous-requests' often fails. The
;; famous reentrant error?
;; * Check, why direct async processes do not work for