From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#6339: url-filename => "/c:/some/file.txt" Date: Mon, 26 Jul 2010 13:50:09 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1280146080 13203 80.91.229.12 (26 Jul 2010 12:08:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 26 Jul 2010 12:08:00 +0000 (UTC) Cc: 6339@debbugs.gnu.org To: Lennart Borgman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 26 14:07:59 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OdMTM-0008Rl-OR for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jul 2010 14:07:57 +0200 Original-Received: from localhost ([127.0.0.1]:38288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdMTL-0008L3-Ub for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jul 2010 08:07:55 -0400 Original-Received: from [140.186.70.92] (port=40315 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdMT9-0008Iz-V2 for bug-gnu-emacs@gnu.org; Mon, 26 Jul 2010 08:07:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdMT2-0006kE-I4 for bug-gnu-emacs@gnu.org; Mon, 26 Jul 2010 08:07:43 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34976) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdMT2-0006kA-FV for bug-gnu-emacs@gnu.org; Mon, 26 Jul 2010 08:07:36 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OdMD0-0002oX-6M; Mon, 26 Jul 2010 07:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Jul 2010 11:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6339 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6339-submit@debbugs.gnu.org id=B6339.128014502710806 (code B ref 6339); Mon, 26 Jul 2010 11:51:02 +0000 Original-Received: (at 6339) by debbugs.gnu.org; 26 Jul 2010 11:50:27 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdMCP-0002oF-TD for submit@debbugs.gnu.org; Mon, 26 Jul 2010 07:50:26 -0400 Original-Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdMCO-0002o9-Mj for 6339@debbugs.gnu.org; Mon, 26 Jul 2010 07:50:25 -0400 Original-Received: by bwz7 with SMTP id 7so3016794bwz.3 for <6339@debbugs.gnu.org>; Mon, 26 Jul 2010 04:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=BukINBBtPRkGmjbb2Kjto4WdBHCmjdApY/lUftzGZ/w=; b=UCXyM9gN7bgPY1ADF7QnJC+0LcW1HxcvAcKX5Vp2ja9Ll1xZH1mPTjqdMDP75XHjzG UQOlgtGieT+036Od7mbcVNusPi8LdyTu0tnNo+QT5gEhbru03WwSZwyp5B8PWA5yBd1e BxzlDCUWl+889iAI/AqCS7F1Zqv55yvrZBLYo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=Wt/KQjBX7YOhmKM74MaK5SAaGlU2PsB3acmw1gKuRNquRGUb/HMFnpoyzzseTSwZpY 171NWNv+ibv4L1b9ZGy/q+4pAQ7HNGTkGL/nE5iwx5vnmj0sWXMMnG3N0b8MjHsCYV7G 9QGcDHLLSsn6JhoKR7Eslmr5BENeRq/i4QtTY= Original-Received: by 10.204.178.146 with SMTP id bm18mr5215074bkb.99.1280145029118; Mon, 26 Jul 2010 04:50:29 -0700 (PDT) Original-Received: by 10.204.180.136 with HTTP; Mon, 26 Jul 2010 04:50:09 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 26 Jul 2010 07:51:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38948 Archived-At: On Thu, Jun 3, 2010 at 04:38, Lennart Borgman w= rote: > (setq x (url-generic-parse-url "file:///c:/some/file.txt")) > (url-filename x) =3D> "/c:/some/file.txt" > > Should not that be "c:/some/file.txt"? This is caused by url-generic-parse-url thinking that in file://HOST/PATH, the path is /PATH, when in fact, according to the relevant RFCs, "/" is a separator and part of the URI syntax, and PATH is an absolute path (to be interpreted as starting from / on Unix, but that's irrelevant). This was extensively discussed in bug#5345. The subyacent cause of the bug, IMHO, is that many software for POSIX environments that parses URIs just takes the /PATH part as a whole because it is easier than removing the slash and then re-adding it. That breaks on Windows file: URIs, as this bug, and #5345, show. So the right fix IMO is as simple as the attached patch. The problem is that it will likely cause trouble for other users of url-generic-parse-url which wrongly assume that the path part will be rooted at /. Another, hacky & ugly, fix is removing the slash only if the PATH part matches /[A-Z]:. I'd rather fix it the good way and watch the fireworks. =C2=A0 =C2=A0 Juanma =3D=3D=3D modified file 'lisp/url/url-parse.el' --- lisp/url/url-parse.el 2010-06-22 16:48:53 +0000 +++ lisp/url/url-parse.el 2010-07-26 11:46:11 +0000 @@ -148,4 +148,5 @@ ;; 3.3. Path + (when (looking-at "/") (forward-char 1)) ;; Gross hack to preserve ';' in data URLs (setq save-pos (point))