From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Daniel Pittman <slippycheeze@google.com>, emacs-devel@gnu.org
Subject: Re: TRAMP VC optimization: also breaks process filters -_-
Date: Tue, 07 May 2019 17:24:42 +0200 [thread overview]
Message-ID: <87lfzi1e4l.fsf@gmx.de> (raw)
In-Reply-To: <jwv8svjiijb.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 06 May 2019 13:54:25 -0400")
[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3008 bytes --]
*** /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."
next prev parent reply other threads:[~2019-05-07 15:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 18:13 TRAMP VC optimization: also breaks process filters -_- Daniel Pittman
2019-05-06 17:54 ` Stefan Monnier
2019-05-07 15:24 ` Michael Albinus [this message]
2019-05-07 15:42 ` Stefan Monnier
2019-05-07 15:51 ` Michael Albinus
2019-05-07 16:19 ` Stefan Monnier
2019-05-08 6:35 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfzi1e4l.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=slippycheeze@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.