From: Eli Zaretskii <eliz@gnu.org>
To: joaotavora@gmail.com (João Távora)
Cc: 18310@debbugs.gnu.org
Subject: bug#18310: 24.3.93; relative links don't work in eww and Windows 7
Date: Thu, 21 Aug 2014 17:04:49 +0300 [thread overview]
Message-ID: <83wqa2aqgu.fsf@gnu.org> (raw)
In-Reply-To: <jjboaverv2b.fsf@gmail.com>
> From: joaotavora@gmail.com (João Távora)
> Date: Thu, 21 Aug 2014 11:33:32 +0100
>
> On Windows 7:
>
> emacs -Q
> M-x eww RET
> http://www.lispworks.com/documentation/HyperSpec/Front/index.htm RET
>
> Try to follow any of the relative links on the page, they point to
> something strange like "www.lispworks.comz" (note the final "z") which
> basically breaks all navigation.
>
> The `shr-url' property at point shows
>
> http://www.lispworks.comz:/documentation/HyperSpec/Front/StartPts.htm
>
> And everything indicates this is a consequence of a previous bug fix of
> mine for bug#17217 [1], which does not manifest itself in my Linux
> box. I'm pretty sure it also did not manifest itself on my old Windows
> XP box.
I'm pretty sure it did happen on XP.
> In that fix, I used the function `expand-file-name' in `shr-expand-url'
> to compute the expanded URL for "totally relative" case of hrefs like
> "../something".
>
> This new bug seems to be caused by `expand-file-name' insisting on
> producing a valid windows pathname (with drive letter), even though it
> was passed the second argument DEFAULT-DIRECTORY.
That's what expand-file-name is supposed to do: it should produce a
fully-qualified file name that unequivocally describes a file. That
means the file name must specify the drive letter.
> That is, on my Windows 7 system:
>
> (expand-file-name "../bla" "/something/else")
>
> expands to
>
> "z:/something/bla"
>
> Whereas I intented it to expand to "/something/bla".
"/something/bla" is not a fully-qualified file name, not on Windows.
As long as the drive letter is not specified, the file name is
ambiguous.
> My HOME variable is set to at "z:", but unsetting it does not help
> either.
I don't think it's because of HOME, since there was no "~" in the file
name. I'm guessing that the default-directory of the buffer where you
used that code was on the z: drive, so Emacs used that to complete the
missing drive letter.
> I don't have time right now to look at the C-code for
> `expand-file-name'.
There's nothing wrong with expand-file-name, please don't waste your
time looking there. The problem is in the change you made. You
cannot use expand-file-name on anything but a file name on a local
filesystem, even if the "thing" you have to deal with happens to look
like a file name and uses slashes as separators. expand-file-name
assumes without testing that its arguments are syntactically valid
local file names, and will produce invalid results if they are not.
Please use url-expand-file-name instead, it does exactly what you
want, and does that portably.
next prev parent reply other threads:[~2014-08-21 14:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 10:33 bug#18310: 24.3.93; relative links don't work in eww and Windows 7 João Távora
2014-08-21 14:04 ` Eli Zaretskii [this message]
2014-08-21 15:43 ` João Távora
2014-08-21 16:17 ` Eli Zaretskii
2014-08-21 16:54 ` João Távora
2014-08-21 19:17 ` Eli Zaretskii
2014-08-22 10:26 ` João Távora
2014-08-22 10:48 ` Eli Zaretskii
2014-08-22 14:39 ` Stefan Monnier
2014-08-22 15:25 ` Eli Zaretskii
2014-08-25 17:23 ` João Távora
2014-08-26 18:11 ` Glenn Morris
2014-08-26 20:37 ` João Távora
2014-08-27 5:05 ` Glenn Morris
2014-09-18 17:56 ` Lars Magne Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83wqa2aqgu.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=18310@debbugs.gnu.org \
--cc=joaotavora@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.