unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: 6339@debbugs.gnu.org
Subject: bug#6339: url-filename => "/c:/some/file.txt"
Date: Mon, 26 Jul 2010 13:50:09 +0200	[thread overview]
Message-ID: <AANLkTi=1oNomjc0aTZ-B0EPhwv4zLbA=nPA1szTq7Ete@mail.gmail.com> (raw)
In-Reply-To: <AANLkTil-z2kKYn8_qKvrFCB8dF6Q7MocBsF-ETzSJHky@mail.gmail.com>

On Thu, Jun 3, 2010 at 04:38, Lennart Borgman <lennart.borgman@gmail.com> wrote:

> (setq x (url-generic-parse-url "file:///c:/some/file.txt"))
> (url-filename x) => "/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.


    Juanma



=== 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))





  parent reply	other threads:[~2010-07-26 11:50 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03  2:38 bug#6339: url-filename => "/c:/some/file.txt" Lennart Borgman
2010-06-03 11:13 ` Juanma Barranquero
2010-07-26 11:50 ` Juanma Barranquero [this message]
2010-07-26 12:00   ` Lennart Borgman
2010-08-01 18:46   ` Juanma Barranquero
2010-08-02  7:51     ` Michael Albinus
2011-09-21 20:28   ` Lars Magne Ingebrigtsen
2011-09-21 22:21     ` Juanma Barranquero
2011-09-21 22:31       ` Lennart Borgman
2011-09-21 22:45         ` Juanma Barranquero
2011-09-21 22:51           ` Lennart Borgman
2011-09-21 22:59             ` Juanma Barranquero
2011-09-21 23:15               ` Lennart Borgman
2011-09-21 23:18                 ` Juanma Barranquero
2011-09-21 23:32                   ` Lennart Borgman
2011-09-21 23:37                     ` Juanma Barranquero
2011-09-21 23:46                       ` Lennart Borgman
2011-09-22  0:32                         ` Juanma Barranquero
2011-09-22  0:40                           ` Lennart Borgman
2011-09-22  0:59                             ` Juanma Barranquero
2011-09-22  1:07                               ` Lennart Borgman
2011-09-22  1:14                                 ` Juanma Barranquero
2011-09-22  9:52                                   ` Lennart Borgman
2011-10-06  5:09                                   ` Kevin Rodgers
2011-10-06 11:56                                     ` Juanma Barranquero
2011-10-06 12:43                                       ` Stefan Monnier
2011-10-06 13:40                                         ` Juanma Barranquero
2011-10-06 14:24                                           ` Jason Rumney
2011-10-06 14:30                                             ` Juanma Barranquero
2011-10-06 14:38                                               ` Jason Rumney
2011-10-06 14:49                                                 ` Juanma Barranquero
2011-10-06 15:08                                                 ` Lennart Borgman
2011-10-06 15:08                                                 ` Lennart Borgman
2011-10-06 15:31                                           ` Stefan Monnier
2011-10-06 15:56                                             ` Juanma Barranquero
2011-10-06 16:49                                               ` Stefan Monnier
2011-10-06 16:54                                                 ` Juanma Barranquero
2011-10-06 21:08                                                   ` Stefan Monnier
2011-09-24  3:35                           ` Jason Rumney
2011-09-24  8:59                             ` Juanma Barranquero
2011-09-24  9:06                               ` Juanma Barranquero
2011-09-24 11:53                               ` Andreas Schwab
2011-09-24 21:56                                 ` Juanma Barranquero
2011-09-24 23:42                                   ` Andreas Schwab
2011-09-25  0:02                                     ` Juanma Barranquero
2011-09-24  9:46                             ` Lennart Borgman
2011-09-24 12:28                             ` Richard Stallman
2012-05-09  9:04   ` Chong Yidong
2012-05-09 11:52     ` Juanma Barranquero
2012-05-10 14:15       ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=1oNomjc0aTZ-B0EPhwv4zLbA=nPA1szTq7Ete@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=6339@debbugs.gnu.org \
    --cc=lennart.borgman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).