Subject: bug#48067: 28.0.50; Tramp error: cannot determine gio monitor

From: Michael Albinus <[email-masked]>
Date: Thu, 29 Apr 2021 12:55:25 +0200

Hi Thierry,

> It works, and I can reproduce the problem. Now debugging.

With the appended patch, it works for me on your machine. Could you pls check?

Best regards, Michael.

diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
index 4a3072ee..321fd7a5 100644
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -3708,7 +3708,8 @@ Fall back to normal file name handler if no Tramp handler exists."
 	(remote-prefix
 	 (with-current-buffer (process-buffer proc)
 	   (file-remote-p default-directory)))
-	(rest-string (process-get proc 'rest-string)))
+	(rest-string (process-get proc 'rest-string))
+	pos)
     (when rest-string
       (tramp-message proc 10 "Previous string:\n%s" rest-string))
     (tramp-message proc 6 "%S\n%s" proc string)
@@ -3737,18 +3738,20 @@ Fall back to normal file name handler if no Tramp handler exists."
           ;; some assumptions.
           ((string-match
             "Can't find module 'help' specified in GIO_USE_FILE_MONITOR" string)
+	   (setq pos (match-end 0))
            (cond
             ((getenv "EMACS_EMBA_CI") 'GInotifyFileMonitor)
             ((eq system-type 'cygwin) 'GPollFileMonitor)
-            (t tramp-cache-undefined)))
+            (t nil)))
           ;; TODO: What happens, if several monitor names are reported?
           ((string-match "\
 Supported arguments for GIO_USE_FILE_MONITOR environment variable:
 \\s-*\\([[:alpha:]]+\\) - 20" string)
+	   (setq pos (match-end 0))
            (intern
 	    (format "G%sFileMonitor" (capitalize (match-string 1 string)))))
-          (t (throw 'doesnt-work nil))))
-	(setq string (substring string (match-end 0))))
+          (t (setq pos (point-max)) nil)))
+	(setq string (substring string pos)))

       ;; Delete empty lines.
       (setq string (tramp-compat-string-replace "\n\n" "\n" string)