[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TRAMP VC optimization: also breaks process filters -_-
From: |
Michael Albinus |
Subject: |
Re: TRAMP VC optimization: also breaks process filters -_- |
Date: |
Tue, 07 May 2019 17:24:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
Hi,
>> I'm sad to report that blocking timers in TRAMP is not sufficient to avoid
>> it breaking other operations: process filters can also run while TRAMP is
>> sending, and waiting for the result of, a command.
>
> I'm not sure what is the problem with timers and/or process filters
> (e.g. I don't see any process filters in your backtrace), so maybe I'm
> misunderstanding the problem, but FWIW, here's what I noticed:
>
>> tramp-user-error(nil "Not a Tramp file name: \"%s\""
>> "/Users/slippycheeze/.emacs.d/network-security.data")
>>
>> tramp-dissect-file-name("/Users/slippycheeze/.emacs.d/network-security.data")
>> tramp-vc-file-name-handler(expand-file-name
>> "/Users/slippycheeze/.emacs.d/network-security.data"
>> "/gssh:slippycheeze.X.XXXXXXXX.XXX:")
>
> This indicates that Tramp gets confused and thinks that the
> tramp-vc-file-name-handler was called in response to expand-file-name on
> the file "/Users/slippycheeze/.emacs.d/network-security.data" whereas
> it's called because of the directory argument.
>
> So I believe the (untested) patch below should fix the immediate problem.
> Can you confirm?
>
> Michael?
Yes, the analysis is correct. However, we don't need to check this for
every Tramp invocation. Daniel's reports have been covered always
vc-registered. And indeed, the related `tramp-vc-file-name-handler'
seems to expect always a Tramp file name, which is not true for filters
and sentinels which run for non-Tramp processes.
Daniel, does the appended patch fixes the issue for you?
> Stefan
Best regards, Michael.
*** /tmp/ediffKys9Ze 2019-05-07 17:22:48.298108293 +0200
--- /home/albinus/src/tramp/lisp/tramp-sh.el 2019-05-07 17:19:08.563550390
+0200
***************
*** 3550,3573 ****
(tramp-replace-environment-variables
(apply #'tramp-file-name-for-operation operation args)))
(fn (assoc operation tramp-sh-file-name-handler-alist)))
! (with-parsed-tramp-file-name filename nil
! (cond
! ;; That's what we want: file names, for which checks are
! ;; applied. We assume that VC uses only `file-exists-p' and
! ;; `file-readable-p' checks; otherwise we must extend the
! ;; list. We do not perform any action, but return nil, in
! ;; order to keep `vc-registered' running.
! ((and fn (memq operation '(file-exists-p file-readable-p)))
! (add-to-list 'tramp-vc-registered-file-names localname 'append)
! nil)
! ;; `process-file' and `start-file-process' shall be ignored.
! ((and fn (eq operation 'process-file) 0))
! ((and fn (eq operation 'start-file-process) nil))
! ;; Tramp file name handlers like `expand-file-name'. They
! ;; must still work.
! (fn (save-match-data (apply (cdr fn) args)))
! ;; Default file name handlers, we don't care.
! (t (tramp-run-real-handler operation args)))))))
(defun tramp-sh-handle-file-notify-add-watch (file-name flags _callback)
"Like `file-notify-add-watch' for Tramp files."
--- 3550,3579 ----
(tramp-replace-environment-variables
(apply #'tramp-file-name-for-operation operation args)))
(fn (assoc operation tramp-sh-file-name-handler-alist)))
! ;; If connection is not established yet, or if it is not a Tramp
! ;; file, run the real handler. This can happen if timers,
! ;; process filters, or process sentinels not related to us are
! ;; activated.
! (if (not (tramp-connectable-p filename))
! (tramp-run-real-handler operation args)
! (with-parsed-tramp-file-name filename nil
! (cond
! ;; That's what we want: file names, for which checks are
! ;; applied. We assume that VC uses only `file-exists-p' and
! ;; `file-readable-p' checks; otherwise we must extend the
! ;; list. We do not perform any action, but return nil, in
! ;; order to keep `vc-registered' running.
! ((and fn (memq operation '(file-exists-p file-readable-p)))
! (add-to-list 'tramp-vc-registered-file-names localname 'append)
! nil)
! ;; `process-file' and `start-file-process' shall be ignored.
! ((and fn (eq operation 'process-file) 0))
! ((and fn (eq operation 'start-file-process) nil))
! ;; Tramp file name handlers like `expand-file-name'. They
! ;; must still work.
! (fn (save-match-data (apply (cdr fn) args)))
! ;; Default file name handlers, we don't care.
! (t (tramp-run-real-handler operation args))))))))
(defun tramp-sh-handle-file-notify-add-watch (file-name flags _callback)
"Like `file-notify-add-watch' for Tramp files."