Some Tramp corrections, Bug#48067

* doc/misc/tramp.texi (Frequently Asked Questions): Rephrase GNU
ELPA warnings.

* lisp/net/tramp-sh.el (tramp-sh-gio-monitor-process-filter):
Improve handling of gio warning.  (Bug#48067)
This commit is contained in:
Michael Albinus 2021-04-29 15:04:51 +02:00
parent 086e29d213
commit a8aa217bff
2 changed files with 15 additions and 11 deletions

View file

@ -5100,12 +5100,12 @@ I get an error @samp{tramp-file-name-handler: Invalid function:
tramp-compat-with-mutex}
@value{tramp} comes with compatibility code for different Emacs
versions. When you see this warning, you don't use the Emacs built-in
version of @value{tramp}. In case you have installed @value{tramp}
from GNU ELPA, see the package README file for instructions how to
recompile it.
versions. When you see such a message (the text might differ), you
don't use the Emacs built-in version of @value{tramp}. In case you
have installed @value{tramp} from GNU ELPA, see the package README
file for instructions how to recompile it.
@ifset installchapter
In case you have installed it from its Git repository, @ref{Recompilation}.
@xref{Recompilation}.
@end ifset

View file

@ -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,22 +3738,23 @@ 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 (length string)) nil)))
(setq string (substring string pos)))
;; Delete empty lines.
(setq string (tramp-compat-string-replace "\n\n" "\n" string)
string (replace-regexp-in-string "^\n" "" string))
(setq string (tramp-compat-string-replace "\n\n" "\n" string))
(while (string-match
(eval-when-compile
@ -3783,6 +3785,8 @@ Supported arguments for GIO_USE_FILE_MONITOR environment variable:
`(file-notify ,object file-notify-callback))))))
;; Save rest of the string.
(while (string-match "^\n" string)
(setq string (replace-match "" nil nil string)))
(when (zerop (length string)) (setq string nil))
(when string (tramp-message proc 10 "Rest string:\n%s" string))
(process-put proc 'rest-string string)))