Subject: Re: bug#68976: 30.0.50; Tramp: unexpected error when calling (file-remote-p "/dav:localhost#8000:/foo")

From: Michael Albinus <[email-masked]>
Date: Thu, 08 Feb 2024 11:25:51 +0100

Version: 30.1

Ihor Radchenko <[email-masked]> writes:

Hi Ihor,

>> If you want to know, whether a file name has remote file name syntax,
>> you should call
>>
>> (string-match-p tramp-file-name-regexp "/dav:localhost#8000:/foo")
>>
>> This variable is documented in the Tramp manual, node "(tramp) Change
>> file name syntax".
>
> Are you saying that I shouldn't use `file-remote-p'?

No.

> For me, the goal is to determine whether file is coming from trusted
> place or not. By default, anything non-local (Urls, TRAMP paths, etc)
> should not be trusted.

I stand corrected. Other Tramp backends do not check whether there is a
valid method. So we even have

--8<---------------cut here---------------start------------->8---
(file-remote-p "/foo:localhost#8000:/foo") => "/foo:localhost#8000:"
--8<---------------cut here---------------end--------------->8---

I've fixed tramp-gvfs.el to behave similar, and to return non-nil for
your example even if tramp-gvfs-enabled is nil. Pushed to master,
closing the bug.

Best regards, Michael.