Re: tramp (2.8.3-pre nil/nil); fix tramp-file-name-for-operation when process is given as a string

Alexey Lebedev <[email protected]>
Newsgroups gmane.emacs.tramp
Message-ID <[email protected]>
On 8/19/26 15:08, Michael Albinus wrote:
 >> diff --git i/lisp/net/tramp.el w/lisp/net/tramp.el
 >> index cb89428886e..52c73dcf92a 100644
 >> --- i/lisp/net/tramp.el
 >> +++ w/lisp/net/tramp.el
 >> @@ -2573,7 +2573,9 @@ Must be handled by the callers."
 >>             ((bufferp (nth 0 args)) (get-buffer (nth 0 args)))
 >>             ((stringp (nth 0 args))
 >>              ;; Process or buffer name.
 >> -            (or (get-process (nth 0 args)) (get-buffer (nth 0 
args)))))))
 >> +            (or (when-let* ((proc (get-process (nth 0 args))))
 >> +                          (process-buffer proc))
 >> +                        (get-buffer (nth 0 args)))))))
 >>        (tramp-get-default-directory buf))
 >>      ""))
 >
 > This clause is intended for file-notify-rm-watch and
 > file-notify-valid-p, which use a process as argument. Could you pls show
 > where it is a problem? Another magic file operation? Please provide an
 > example, including a backtrace.

The first clause of "cond" (not visible in patch) ensures that "buf" 
will be a buffer:

            ((processp (nth 0 args)) (process-buffer (nth 0 args)))

and the same logic should be applied to the results of (get-process), as 
it surely satisfies "processp".

This is needed because (tramp-get-default-directory) expects a buffer as 
an argument.


Below is the story of why I was able to hit this error, but it's not 
that interesting (in the context of the fix):
- inferior prolog does (process-send-string "prolog" ...) - with process 
identified by a string
- tramp-rpc backend adds "process-send-string" to 
"tramp-file-name-for-operation-external" - and it's being checked in
   addition to file-notify-rm-watch and file-notify-valid-p


Best,
Alexey
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.