From: Juanma Barranquero <lekktu@gmail.com>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: 6339@debbugs.gnu.org
Subject: bug#6339: url-filename => "/c:/some/file.txt"
Date: Thu, 22 Sep 2011 00:21:03 +0200 [thread overview]
Message-ID: <CAAeL0SSd+XnunB7i0zkz170aVhX=ZGMYnKgW-yTvPvyirs2BsQ@mail.gmail.com> (raw)
In-Reply-To: <m3fwjpwsgu.fsf@stories.gnus.org>
On Wed, Sep 21, 2011 at 22:28, Lars Magne Ingebrigtsen <larsi@gnus.org> wrote:
> If I say:
>
> (setq x (url-generic-parse-url "file:///home/larsi/foo.txt"))
>
> Then I get
>
> (url-filename x)
> => "/home/larsi/foo.txt"
>
> as expected. Would your patch break that?
My patch would return "home/larsi/foo.txt", yes.
But expecting the slash is a "bug" in you expectations, because the
*filename* (the path, according to the RFCs, see below) of
file:///home/larsi/foo.txt
is not "/home/larsi/foo.txt". The slash is a separator, part of the
URI syntax, and "home/larsi/foo.txt" is an absolute path. It's easier
to see it with the full syntax, in things like
file://localhost/home/larsi/foo.txt
for example. The fact that url-filename returns the slash is a bug;
just one that nobody has fixed or complained about because it makes
easier to process the path than having to do
(concat "/" (url-filename "file:///mypath"))
At least, until you have a Windows URI. And no, this is *not* a
Windows problem or a Windows bug, it's a bug that makes life easier
for POSIX at the cost of making it uglier for Windows.
Juanma
From RFC 1738 "Uniform Resource Locators (URL)"
3.10 FILES
The file URL scheme is used to designate files accessible on a
particular host computer. This scheme, unlike most other URL schemes,
does not designate a resource that is universally accessible over the
Internet.
A file URL takes the form:
file://<host>/<path>
where <host> is the fully qualified domain name of the system on
which the <path> is accessible, and <path> is a hierarchical
directory path of the form <directory>/<directory>/.../<name>.
For example, a VMS file
DISK$USER:[MY.NOTES]NOTE123456.TXT
might become
<URL:file://vms.host.edu/disk$user/my/notes/note12345.txt>
As a special case, <host> can be the string "localhost" or the empty
string; this is interpreted as `the machine from which the URL is
being interpreted'.
The file URL scheme is unusual in that it does not specify an
Internet protocol or access method for such files; as such, its
utility in network protocols between hosts is limited.
next prev parent reply other threads:[~2011-09-21 22:21 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
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 [this message]
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='CAAeL0SSd+XnunB7i0zkz170aVhX=ZGMYnKgW-yTvPvyirs2BsQ@mail.gmail.com' \
--to=lekktu@gmail.com \
--cc=6339@debbugs.gnu.org \
--cc=larsi@gnus.org \
/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).