Subject: bug#49043: 27.1: ibuffer-toggle-filter-group [BUGFIX]

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 19 Jun 2021 14:06:59 +0200

Stephen Berman <[email-masked]> writes:

> I do.  It's the result of an error being raised in Tramp.  Here's the
> recipe (reliably reproducible on

Thanks for the thorough recipe -- I was able to reproduce the problem,
too.

> 6. Type `M-x ibuffer'.
> => This raises the error "tramp-error: Method ‘archive’ is not known."

Here's the backtrace for that:

Debugger entered--Lisp error: (user-error "Method ‘archive’ is not known.")
  signal(user-error ("Method ‘archive’ is not known."))
  tramp-error((tramp-file-name "archive" nil nil "file%3A%2F%2F%2Ftmp%2Ffoo.zip" nil "" nil) user-error "Method `%s' is not known." "archive")
  apply(tramp-error (tramp-file-name "archive" nil nil "file%3A%2F%2F%2Ftmp%2Ffoo.zip" nil "" nil) user-error "Method `%s' is not known." "archive")
  tramp-user-error((tramp-file-name "archive" nil nil "file%3A%2F%2F%2Ftmp%2Ffoo.zip" nil "" nil) "Method `%s' is not known." "archive")
  tramp-dissect-file-name("/archive:file%3A%2F%2F%2Ftmp%2Ffoo.zip:")
  tramp-file-name-handler(expand-file-name "" "/archive:file%3A%2F%2F%2Ftmp%2Ffoo.zip:")
  file-name-case-insensitive-p("")
  abbreviate-file-name("")
  ibuffer--abbreviate-file-name("")
  ibuffer-make-column-filename(#<buffer *tramp/archive file%3A%2F%2F%2Ftmp%2Ffoo.zip*> 32)
  ibuffer-make-column-filename-and-process(#<buffer *tramp/archive file%3A%2F%2F%2Ftmp%2Ffoo.zip*> 32)
  #f(compiled-function (buffer mark) #<bytecode 0xa9479abf87c6c30>)(#<buffer *tramp/archive file%3A%2F%2F%2Ftmp%2Ffoo.zip*> 32)
  ibuffer-insert-buffer-line(#<buffer *tramp/archive file%3A%2F%2F%2Ftmp%2Ffoo.zip*> 32 #f(compiled-function (buffer mark) #<bytecode 0xa9479abf87c6c30>))
  ibuffer-insert-filter-group("Default" "Default" "" #f(compi
  ibuffer-redisplay-engine(((#<buffer tmp> . 32) (#<buffer *C
  ibuffer-update(nil)
  ibuffer(nil)
  funcall-interactively(ibuffer nil)

> Step 3 of the recipe is necessary to raise the above errors.  I guess
> dired-guess-shell-command triggers Tramp file handling.  CCing Michael
> Albinus, who should be able to solve the problem.

3) does indeed seem to be a Tramp problem, but I wonder if ibuffer
should be more resilient here?  That is, to avoid messing up the
ibuffer, we could do something like:

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 9088f31053..73ddfb260c 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1184,7 +1184,11 @@ ibuffer-buffer-file-name
 (defun ibuffer--abbreviate-file-name (filename)
   "Abbreviate FILENAME using `ibuffer-directory-abbrev-alist'."
   (let ((directory-abbrev-alist ibuffer-directory-abbrev-alist))
-    (abbreviate-file-name filename)))
+    (condition-case ()
+        ;; This may fail if the filename is a Tramp filename that is
+        ;; invalid.
+        (abbreviate-file-name filename)
+      (error filename))))
 
 (define-ibuffer-op ibuffer-do-save ()
   "Save marked buffers as with `save-buffer'."

Any comments?

(This would be in addition to actually fixing 3).)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no