From unknown Tue Jun 17 22:29:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42869: [PATCH] Fix url-expand-file-name when applied to file:/// URLs Resent-From: Steven Allen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Aug 2020 20:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42869 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 42869@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15974374869747 (code B ref -1); Fri, 14 Aug 2020 20:39:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Aug 2020 20:38:06 +0000 Received: from localhost ([127.0.0.1]:53976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6gSk-0002X8-9B for submit@debbugs.gnu.org; Fri, 14 Aug 2020 16:38:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:35518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6gSh-0002X0-UW for submit@debbugs.gnu.org; Fri, 14 Aug 2020 16:38:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6gSh-0006KD-Nr for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 16:38:03 -0400 Received: from outgoing-stata.csail.mit.edu ([128.30.2.210]:39390) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6gSf-0004Bs-Tg for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 16:38:03 -0400 Received: from c-73-241-148-239.hsd1.ca.comcast.net ([73.241.148.239] helo=localhost) by outgoing-stata.csail.mit.edu with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1k6gSX-000Nba-CR for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 16:37:53 -0400 From: Steven Allen Date: Fri, 14 Aug 2020 13:37:51 -0700 Message-Id: <20200814203751.35684-1-steven@stebalien.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=128.30.2.210; envelope-from=steven@stebalien.com; helo=outgoing-stata.csail.mit.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 16:37:53 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 From unknown Tue Jun 17 22:29:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#42869: [PATCH] Fix url-expand-file-name when applied to file:/// URLs Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Aug 2020 11:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42869 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Steven Allen Cc: 42869@debbugs.gnu.org Received: via spool by 42869-submit@debbugs.gnu.org id=B42869.15974914989820 (code B ref 42869); Sat, 15 Aug 2020 11:39:01 +0000 Received: (at 42869) by debbugs.gnu.org; 15 Aug 2020 11:38:18 +0000 Received: from localhost ([127.0.0.1]:54369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6uVe-0002Xv-Rh for submit@debbugs.gnu.org; Sat, 15 Aug 2020 07:38:17 -0400 Received: from quimby.gnus.org ([95.216.78.240]:52940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6uVe-0002XR-0s for 42869@debbugs.gnu.org; Sat, 15 Aug 2020 07:38:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6rM//sN+F7FUPL1pXolaAmPt54y+fOSy4Xk8zdU5BTI=; b=lhpKl8rebSPPy4VS8lMeEZBp4B 2dnRgg+lw1BlTrnS4lTPXfOldNYuoAsHkSjauXJGHCL55UxIC0oz+9PvTFILD18DeELD05ThJu+ny GBL1Z4ONWiCBbwFp5WuDZmPqoS7yJ5BlRh4PVQSKVoZA21cWPGcuND4wS1yVQ8cQX49Q=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6uVV-00077J-Mw; Sat, 15 Aug 2020 13:37:56 +0200 From: Lars Ingebrigtsen References: <20200814203751.35684-1-steven@stebalien.com> X-Now-Playing: Epic 45's _We Were Never Here_: "Through Frosted Glass" Date: Sat, 15 Aug 2020 13:37:52 +0200 In-Reply-To: <20200814203751.35684-1-steven@stebalien.com> (Steven Allen's message of "Fri, 14 Aug 2020 13:37:51 -0700") Message-ID: <874kp4ywa7.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Steven Allen 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-expan [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Steven Allen 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 15 07:38:18 2020 Received: (at control) by debbugs.gnu.org; 15 Aug 2020 11:38:18 +0000 Received: from localhost ([127.0.0.1]:54372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6uVt-0002YL-Ul for submit@debbugs.gnu.org; Sat, 15 Aug 2020 07:38:18 -0400 Received: from quimby.gnus.org ([95.216.78.240]:52958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6uVn-0002Y0-4P for control@debbugs.gnu.org; Sat, 15 Aug 2020 07:38:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=1AYV2OSShgZGALohNNJiRwAnzV5AMXfT0LwxIzqRZSM=; b=CJX21NomDvXPHXsAuZ/gGzENZR D8QV3mpibr9R6ifLJerRxoHcA0hmSvL8jiEAe+aRSWvEAruo7PLFQJzOOo0eU1tuOtEpzBVZl/gtu BAX+52hMQrMbhwLc9/abWcrkRIcwC9oW0wm0vtTIMkkXTonYkDb41dPK+dU/3vh3lqME=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6uVf-00077U-DS for control@debbugs.gnu.org; Sat, 15 Aug 2020 13:38:05 +0200 Date: Sat, 15 Aug 2020 13:38:02 +0200 Message-Id: <87364oyw9x.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #42869 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 42869 fixed close 42869 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 42869 fixed close 42869 28.1 quit