Subject: bug#34196: 27.0.50; tramp hangs on wrong password with global-auto-revert-mode

From: Aaron Jensen <[email-masked]>
Date: Tue, 5 Feb 2019 08:43:52 -0800

On Tue, Feb 5, 2019 at 4:51 AM Michael Albinus <[email-masked]> wrote:
>
> [Pls keep the Cc, for the archives]

Sorry, clicked the wrong button, thank you for the reminder.

> > I think that not-yet-connected tramp buffers need to be excluded from
> > garm entirely, if that is possible.
>
> Good idea. I've appended a patch, which reverts the last change from
> tramp.el, and implements your proposal in autorevert.el. This is also
> better, because Tramp as library shouldn't care about auto-revert.
>
> Could you, pls, check whether this works for you?

It works brilliantly as far as I can tell in both emacs -Q and my config.

Is there any cost to an extra loop over all buffers and doing
with-current-buffer?

I wonder if a change to auto-revert-active-p would be better than
looping through all of the buffers and with-current-buffering them
again. I don't know if that's semantically wrong for that function.

Another option is putting a check in auto-revert-notify-add-watch,
since that already has checks to ensure the file is okay to be
watched:

          (or auto-revert-notify-watch-descriptor
              (and (file-remote-p default-directory)
                   (not (file-remote-p default-directory nil t)))
              (string-match auto-revert-notify-exclude-dir-regexp
                            (expand-file-name default-directory))
              (file-symlink-p (or buffer-file-name default-directory)))

With that in place, even if I enable auto-revert-remote-files I don't
experience the hang.

Thanks,

Aaron