GNU bug report logs - #42869
[PATCH] Fix url-expand-file-name when applied to file:/// URLs

Previous Next

Package: emacs;

Reported by: Steven Allen <steven <at> stebalien.com>

Date: Fri, 14 Aug 2020 20:39:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 42869 in the body.
You can then email your comments to 42869 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#42869; Package emacs. (Fri, 14 Aug 2020 20:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steven Allen <steven <at> stebalien.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 14 Aug 2020 20:39:01 GMT) Full text and rfc822 format available.

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

From: Steven Allen <steven <at> stebalien.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix url-expand-file-name when applied to file:/// URLs
Date: Fri, 14 Aug 2020 13:37:51 -0700
This code is supposed to update the portspec slot in the url object,
but was attempting to setf whatever url-port happened to return (not
necessarily the portspec slot).

* lisp/url/url-expand.el (url-default-expander): Set `url-portspec'.
---
 lisp/url/url-expand.el            | 2 +-
 test/lisp/url/url-expand-tests.el | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el
index f34ef810c4a..be9b5426dc4 100644
--- a/lisp/url/url-expand.el
+++ b/lisp/url/url-expand.el
@@ -120,7 +120,7 @@ url-default-expander
       ;; Well, they told us the scheme, let's just go with it.
       nil
     (setf (url-type urlobj) (or (url-type urlobj) (url-type defobj)))
-    (setf (url-port urlobj) (or (url-portspec urlobj)
+    (setf (url-portspec urlobj) (or (url-portspec urlobj)
                                 (and (string= (url-type urlobj)
                                               (url-type defobj))
 				     (url-port defobj))))
diff --git a/test/lisp/url/url-expand-tests.el b/test/lisp/url/url-expand-tests.el
index 6e0ce869502..3b0b6fbd41a 100644
--- a/test/lisp/url/url-expand-tests.el
+++ b/test/lisp/url/url-expand-tests.el
@@ -100,6 +100,13 @@ url-expand-file-name/relative-resolution-additional-examples
   (should (equal (url-expand-file-name "foo#bar" "http://host/foobar") "http://host/foo#bar"))
   (should (equal (url-expand-file-name "foo#bar" "http://host/foobar/") "http://host/foobar/foo#bar")))
 
+(ert-deftest url-expand-file-name/relative-resolution-file-url ()
+  "RFC 3986, Section 5.4 Reference Resolution Examples / Section 5.4.1. Normal Examples"
+  (should (equal (url-expand-file-name "bar.html"          "file:///a/b/c/foo.html") "file:///a/b/c/bar.html"))
+  (should (equal (url-expand-file-name "bar.html"          "file:///a/b/c/")         "file:///a/b/c/bar.html"))
+  (should (equal (url-expand-file-name "../d/bar.html"     "file:///a/b/c/")         "file:///a/b/d/bar.html"))
+  (should (equal (url-expand-file-name "../d/bar.html"     "file:///a/b/c/foo.html") "file:///a/b/d/bar.html")))
+
 (provide 'url-expand-tests)
 
 ;;; url-expand-tests.el ends here
-- 
2.28.0





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42869; Package emacs. (Sat, 15 Aug 2020 11:39:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Steven Allen <steven <at> stebalien.com>
Cc: 42869 <at> debbugs.gnu.org
Subject: Re: bug#42869: [PATCH] Fix url-expand-file-name when applied to
 file:/// URLs
Date: Sat, 15 Aug 2020 13:37:52 +0200
Steven Allen <steven <at> stebalien.com> writes:

> This code is supposed to update the portspec slot in the url object,
> but was attempting to setf whatever url-port happened to return (not
> necessarily the portspec slot).
>
> * lisp/url/url-expand.el (url-default-expander): Set `url-portspec'.

Thanks; applied to Emacs 28.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 15 Aug 2020 11:39:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 42869 <at> debbugs.gnu.org and Steven Allen <steven <at> stebalien.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 15 Aug 2020 11:39:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 Sep 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 276 days ago.

Previous Next


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