GNU bug report logs - #55357
29.0.50; [PATCH] Fix browse-url-emacs on file:// urls

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Wed, 11 May 2022 07:06:02 UTC

Severity: normal

Tags: moreinfo, patch

Found in version 29.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55357 in the body.
You can then email your comments to 55357 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55357; Package emacs. (Wed, 11 May 2022 07:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuan Fu <casouri <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 11 May 2022 07:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Bug Report Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 29.0.50; [PATCH] Fix browse-url-emacs on file:// urls
Date: Wed, 11 May 2022 00:05:50 -0700
[Message part 1 (text/plain, inline)]
If you call browse-url-emacs with a file:// url, Emacs does not open the correct file:

(browse-url-emacs "file://~/a/b") opens /a/b
(browse-url-emacs "file://a/b") opens /b

Basically unless the path is an absolute path, the first level is chopped because url parses it as host and throws it away. This patch concats the host back. If the path is absolute, host is empty string so it’s ok.

Yuan

[file-url.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55357; Package emacs. (Wed, 11 May 2022 07:55:01 GMT) Full text and rfc822 format available.

Message #8 received at 55357 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 55357 <at> debbugs.gnu.org
Subject: Re: bug#55357: 29.0.50; [PATCH] Fix browse-url-emacs on file:// urls
Date: Wed, 11 May 2022 09:53:59 +0200
On Mai 11 2022, Yuan Fu wrote:

> (browse-url-emacs "file://~/a/b") opens /a/b
> (browse-url-emacs "file://a/b") opens /b

That is correct.  The component after file:// is always the host part.
See RFC8089 for the full specification.

> Basically unless the path is an absolute path, the first level is chopped because url parses it as host and throws it away. This patch concats the host back. If the path is absolute, host is empty string so it’s ok.

The host part can be non-empty, too.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55357; Package emacs. (Wed, 11 May 2022 11:38:01 GMT) Full text and rfc822 format available.

Message #11 received at 55357 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 55357 <at> debbugs.gnu.org
Subject: Re: bug#55357: 29.0.50; [PATCH] Fix browse-url-emacs on file:// urls
Date: Wed, 11 May 2022 14:37:17 +0300
> Resent-From: Yuan Fu <casouri <at> gmail.com>
> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
> Resent-CC: bug-gnu-emacs <at> gnu.org
> Resent-Sender: help-debbugs <at> gnu.org
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Wed, 11 May 2022 00:05:50 -0700
> 
> 
> [1:text/plain Hide]
> 
> 
> If you call browse-url-emacs with a file:// url, Emacs does not open the correct file:
> 
> (browse-url-emacs "file://~/a/b") opens /a/b
> (browse-url-emacs "file://a/b") opens /b
> 
> Basically unless the path is an absolute path, the first level is chopped because url parses it as host and throws it away. This patch concats the host back. If the path is absolute, host is empty string so it’s ok.

I think your URLs lack one or two more slashes.  See

  https://en.wikipedia.org/wiki/File_URI_scheme#How_many_slashes?




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 May 2022 12:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55357; Package emacs. (Wed, 11 May 2022 18:36:02 GMT) Full text and rfc822 format available.

Message #16 received at 55357 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55357 <at> debbugs.gnu.org
Subject: Re: bug#55357: 29.0.50; [PATCH] Fix browse-url-emacs on file:// urls
Date: Wed, 11 May 2022 11:35:32 -0700

> On May 11, 2022, at 4:37 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Resent-From: Yuan Fu <casouri <at> gmail.com>
>> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
>> Resent-CC: bug-gnu-emacs <at> gnu.org
>> Resent-Sender: help-debbugs <at> gnu.org
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Wed, 11 May 2022 00:05:50 -0700
>> 
>> 
>> [1:text/plain Hide]
>> 
>> 
>> If you call browse-url-emacs with a file:// url, Emacs does not open the correct file:
>> 
>> (browse-url-emacs "file://~/a/b") opens /a/b
>> (browse-url-emacs "file://a/b") opens /b
>> 
>> Basically unless the path is an absolute path, the first level is chopped because url parses it as host and throws it away. This patch concats the host back. If the path is absolute, host is empty string so it’s ok.
> 
> I think your URLs lack one or two more slashes. See
> 
> https://en.wikipedia.org/wiki/File_URI_scheme#How_many_slashes?

Ah! My bad. Closing.

Yuan





Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Wed, 11 May 2022 18:37:01 GMT) Full text and rfc822 format available.

Notification sent to Yuan Fu <casouri <at> gmail.com>:
bug acknowledged by developer. (Wed, 11 May 2022 18:37:02 GMT) Full text and rfc822 format available.

Message #21 received at 55357-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: 55357-done <at> debbugs.gnu.org
Subject: Re: bug#55357: 29.0.50; [PATCH] Fix browse-url-emacs on file:// urls
Date: Wed, 11 May 2022 11:35:58 -0700

> On May 11, 2022, at 11:35 AM, Yuan Fu <casouri <at> gmail.com> wrote:
> 
> 
> 
>> On May 11, 2022, at 4:37 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 
>>> Resent-From: Yuan Fu <casouri <at> gmail.com>
>>> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
>>> Resent-CC: bug-gnu-emacs <at> gnu.org
>>> Resent-Sender: help-debbugs <at> gnu.org
>>> From: Yuan Fu <casouri <at> gmail.com>
>>> Date: Wed, 11 May 2022 00:05:50 -0700
>>> 
>>> 
>>> [1:text/plain Hide]
>>> 
>>> 
>>> If you call browse-url-emacs with a file:// url, Emacs does not open the correct file:
>>> 
>>> (browse-url-emacs "file://~/a/b") opens /a/b
>>> (browse-url-emacs "file://a/b") opens /b
>>> 
>>> Basically unless the path is an absolute path, the first level is chopped because url parses it as host and throws it away. This patch concats the host back. If the path is absolute, host is empty string so it’s ok.
>> 
>> I think your URLs lack one or two more slashes. See
>> 
>> https://en.wikipedia.org/wiki/File_URI_scheme#How_many_slashes?
> 
> Ah! My bad. Closing.
> 
> Yuan
> 





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 09 Jun 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.