Richard Copley <rcop...@gmail.com> writes:

Hi Richard,

> Recipe starting from 'emacs -Q', on Windows assuming a PuTTy session
> called "session" is configured:
>
> C-x C-f /plink:session:/tmp RET
> M-x grep-find RET
> x RET
>
> This occurs because 'null-device' is let-bound to nil in 'grep-find',
> and this is not handled by the regex constructor in
> tramp-sh-handle-expand-file-name (only used on Windows). Evaluating
> the following form gives the same error:
>
> (let ((null-device nil))
>   (rx bol (| (: alpha ":") (: (literal null-device) eol))))

Thanks for the report and the analysis! Could you pls check, whether the
appended patch fixes this?

Best regards, Michael.

diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
index 3ab58c27..0cb953e2 100644
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -2715,7 +2715,8 @@ the result will be a local, non-Tramp, file name."
   ;; there could be the false positive "/:".
   (if (or (and (eq system-type 'windows-nt)
 	       (string-match-p
-		(rx bol (| (: alpha ":") (: (literal null-device) eol))) name))
+		(rx bol (| (: alpha ":") (: (literal (or null-device "")) eol)))
+		name))
 	  (and (not (tramp-tramp-file-p name))
 	       (not (tramp-tramp-file-p dir))))
       (tramp-run-real-handler #'expand-file-name (list name dir))

Reply via email to