Subject: bug#40425: 26.3; eww-open-file is not working with a Tramp file name

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 17 Jul 2020 16:39:20 +0200

[email-masked] (H. Dieter Wilhelm) writes:

> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>   url-file-asynch-callback(nil nil nil
> "/:/ssh:stories:/home/larsi/.emacs.d/bookiez.data" #<buffer
> *url-file*-73983> eww-render (nil
> "file:///ssh:stories:/home/larsi/.emacs.d/bookiez.d..." nil #<buffer
> *eww*>))

This is due to the following patch, and the moron who committed it
neglected to say what problem it was trying to fix:

commit 023ec128fd95eadac7b607177969267cc8b9accf
Author: Lars Magne Ingebrigtsen <[email-masked]>
Date:   Tue Nov 16 14:46:12 2010 +0100

    Avoid interpreting file:/foo:/bar URLs via tramp.

The following patch makes the test case work again...  but this is
basically what I added in 2010:

diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el
index eec7cdfbe8..77495d7e57 100644
--- a/lisp/url/url-file.el
+++ b/lisp/url/url-file.el
@@ -110,9 +110,6 @@ url-file-build-filename
 		    ((and (string-match "\\`/[a-zA-Z]:/" file)
 			  (memq system-type '(ms-dos windows-nt)))
 		     (substring file 1))
-		    ;; file: URL with a file:/bar:/foo-like spec.
-		    ((string-match "\\`/[^/]+:/" file)
-		     (concat "/:" file))
 		    (t
 		     file))))
 
*sigh*

My guess is that this attempt to fix the problem of file names that
contain colons without actually being tramp files?

I don't quite know what the solution is here...  it does seem odd for a
low-level library like URL to call out to tramp -- that may even have
security implications: It's very unexpected that (say) hitting a link on
a web page ends up with you ssh-ing to a local machine.  So in that
regard I agree with my 2010 self.

But it does make eww-open-file, which should accept tramp file names,
very awkward to implement...

Any opinions?

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