Subject: 27.0.50; commands breaking on unreachable remote directory

From: Ken Raeburn <[email-masked]>
Date: Tue, 04 Aug 2020 09:55:04 -0400

A couple commands I've tried have failed if the default directory for a
buffer is remote and the server is unreachable. One was list-buffers
when one of my buffers (not the current one) was visiting a remote file
on a server that was down.  The other was cd, when the current default
directory was remote. In both cases, the file-error error ("Timeout
reached") was raised and not trapped. The cd command did not get to the
point of prompting me for a new directory. Stack traces are below. Looks
like a common failure point is calling abbreviate-file-name, which calls
file-name-case-insensitive-p, which under tramp/scp runs remote
commands, or tries to.

While file-name-case-insensitive-p can't guarantee a reasonable answer
in the case of a failed connection, it looks to me like
abbreviate-file-name could probably fail safe by assuming case
sensitivity and continuing on.

I haven't noticed these problems before trying Emacs 27 pretests, but I
may have just gotten lucky.

Debugger entered--Lisp error: (file-error "Timeout reached, see buffer ‘*tramp/scp root@thomp...")
  signal(file-error ("Timeout reached, see buffer ‘*tramp/scp root@thomp..."))
  tramp-signal-hook-function(file-error ("Timeout reached, see buffer ‘*tramp/scp root@thomp..."))
  signal(file-error ("Timeout reached, see buffer ‘*tramp/scp root@thomp..."))
  tramp-maybe-open-connection((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil))
  tramp-send-command((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil) "test 0 2>/dev/null; echo tramp_exit_status $?")
  tramp-send-command-and-check((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil) "test 0")
  tramp-get-test-command((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil))
  tramp-run-test("-d" "[scp-path]")
  tramp-sh-handle-file-directory-p("[scp-path]")
  apply(tramp-sh-handle-file-directory-p "[scp-path]")
  tramp-sh-file-name-handler(file-directory-p "[scp-path]")
  apply(tramp-sh-file-name-handler file-directory-p "[scp-path]")
  tramp-file-name-handler(file-directory-p "[scp-path]")
  file-directory-p("[scp-path]")
  apply(file-directory-p "[scp-path]")
  tramp-archive-run-real-handler(file-directory-p ("[scp-path]"))
  tramp-archive-file-name-handler(file-name-case-insensitive-p "[scp-path]")
  file-name-case-insensitive-p("[scp-path]")
  abbreviate-file-name("[scp-path]")
  Buffer-menu--pretty-file-name("[scp-path]")
  list-buffers--refresh(nil #<buffer *scratch*>)
  list-buffers-noselect(nil)
  list-buffers(nil)
  funcall-interactively(list-buffers nil)
  call-interactively(list-buffers nil nil)
  command-execute(list-buffers)

Debugger entered--Lisp error: (file-error "Timeout reached, see buffer ‘*tramp/scp root@thomp...")
  signal(file-error ("Timeout reached, see buffer ‘*tramp/scp root@thomp..."))
  tramp-signal-hook-function(file-error ("Timeout reached, see buffer ‘*tramp/scp root@thomp..."))
  signal(file-error ("Timeout reached, see buffer ‘*tramp/scp root@thomp..."))
  tramp-maybe-open-connection((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil))
  tramp-send-command((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil) "test 0 2>/dev/null; echo tramp_exit_status $?")
  tramp-send-command-and-check((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil) "test 0")
  tramp-get-test-command((tramp-file-name "scp" "root" nil "[host]" nil "[path]..." nil))
  tramp-run-test("-d" "[scp-path]")
  tramp-sh-handle-file-directory-p("[scp-path]")
  apply(tramp-sh-handle-file-directory-p "[scp-path]")
  tramp-sh-file-name-handler(file-directory-p "[scp-path]")
  apply(tramp-sh-file-name-handler file-directory-p "[scp-path]")
  tramp-file-name-handler(file-directory-p "[scp-path]")
  file-directory-p("[scp-path]")
  apply(file-directory-p "[scp-path]")
  tramp-archive-run-real-handler(file-directory-p ("[scp-path]"))
  tramp-archive-file-name-handler(file-name-case-insensitive-p "[scp-path]")
  file-name-case-insensitive-p("[scp-path]")
  abbreviate-file-name("[scp-path]")
  read-file-name-default("Change default directory: " "[scp-path]" "[scp-path]" t nil file-directory-p)
  read-file-name("Change default directory: " "[scp-path]" "[scp-path]" t nil file-directory-p)
  read-directory-name("Change default directory: " "[scp-path]" "[scp-path]" t)
  byte-code(... [cd-path default-directory #f(compiled-function () #<bytecode 0x1fd5f0c2e0f3>) nil make-byte-code 0 ... vconcat vector [remove-hook minibuffer-setup-hook] 3 ... [remove-hook minibuffer-setup-hook] add-hook minibuffer-setup-hook parse-colon-path getenv "CDPATH" "./" read-directory-name "Change default directory: " t] 10)
  call-interactively(cd record nil)
  command-execute(cd record)
  execute-extended-command(nil "cd" "cd")
  funcall-interactively(execute-extended-command nil "cd" "cd")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2019-11-18 built on crash
Repository revision: ed52618e707682e812002c98b99efe4baf43e1ca
Repository branch: master
Windowing system distributor 'Fedora Project', version 11.0.12006000
System Description: Fedora 31 (Workstation Edition)

Recent messages:
Timeout reached, see buffer ‘*tramp/scp [email-masked]*’ for details
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for [email-masked] using scp...failed
Entering debugger...
Mark set [4 times]
Back to top level
Entering debugger...
Back to top level
uncompressing files.el.gz...done
GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2019-11-18
Quit
Configured using:
 'configure --prefix=/home/raeburn/dev/emacs/Install-20191118T1638'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS
LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  rcirc-track-minor-mode: t
  display-time-mode: t
  desktop-save-mode: t
  global-edit-server-edit-mode: t
  which-function-mode: t
  icomplete-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/raeburn/elisp/with-editor hides /home/raeburn/.emacs.d/elpa/with-editor-20181113.1845/with-editor

Features:
(shadow emacsbug debug backtrace thai-util thai-word lao-util enriched
view tramp-archive tramp-gvfs zeroconf dbus org-table eww mm-url
url-queue ansible-doc ansible poly-ansible poly-ansible-jinja2-filters
polymode poly-lock polymode-base polymode-weave polymode-export
polymode-compat polymode-methods polymode-core polymode-classes
eieio-custom color term/xterm xterm vc vc-dispatcher eieio-opt speedbar
sb-image ezimage dframe mh-compat mh-buffers mh-loaddefs gnus-registry
registry eieio-base gnus-salt gnus-topic gnus-uu yenc gnus-vm ispell
tramp-cmds f s vagrant-tramp dash autoload lisp-mnt tar-mode arc-mode
archive-mode url-http url-gw url-cache url-auth mm-archive smiley
gnus-cite gnus-async gnus-bcklg qp gnus-ml mailalias smtpmail sendmail
sort grep mail-extr tabify cus-edit help-fns radix-tree cl-print ielm pp
misearch multi-isearch with-editor async-bytecomp async thingatpt
tramp-cache nndraft nnmh nnfolder utf-7 gnutls gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache network-stream
nsm add-log mule-util cl-extra help-mode rst compile sh-script
executable face-remap conf-mode adaptive-wrap systemtap-mode cc-langs
cc-awk cperl-mode perl-mode python tramp-sh tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat ls-lisp smerge-mode diff
make-mode org-rmail org-mhe org-irc org-info org-gnus nnir org-docview
doc-view jka-compr image-mode exif org-bibtex bibtex org-bbdb org-w3m
org-element avl-tree generator org org-macro org-footnote org-pcomplete
org-list org-faces org-entities noutline outline org-version ob-shell
shell pcomplete ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs ruby-mode smie
vc-git diff-mode cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs yaml-mode rcirc gnus-art mm-uu
mml2015 mm-view mml-smime smime dig gnus-sum url url-proxy url-privacy
url-expand url-methods url-history mailcap shr url-cookie url-domsuf
url-util svg xml dom gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range message rmc puny dired dired-loaddefs format-spec rfc822 mml
mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
time desktop frameset cus-start cus-load kr-init edit-server iso-transl
advice smart-quotes easy-mmode which-func imenu icomplete server term
disp-table comint ansi-color ehelp ring hi-lock finder-inf info package
easymenu browse-url url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 12331780 1040220)
 (symbols 48 58354 53)
 (strings 32 582500 68903)
 (string-bytes 1 19352387)
 (vectors 16 94302)
 (vector-slots 8 1829418 441520)
 (floats 8 634 525)
 (intervals 56 1342629 27544)
 (buffers 1000 1630))