GNU bug report logs -
#39349
browse-url-of-dired-file should respect directory symlinks
Previous Next
Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Date: Wed, 29 Jan 2020 21:41:01 UTC
Severity: wishlist
Tags: notabug
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39349 in the body.
You can then email your comments to 39349 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Wed, 29 Jan 2020 21:41:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 29 Jan 2020 21:41:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
browse-url-of-dired-file should respect directory symlinks.
E.g.,
$ emacs -q
C-x d /cf/updates/
SPC SPC SPC
M-x browse-url-of-dired-file
should call the browser on
file:///cf/updates/52.html
not the absolute path
file:///mnt/usb/cf/updates/52.html
Else what is the point of symlinks?
emacs-version "26.3"
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Sun, 19 Jul 2020 19:49:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 39349 <at> debbugs.gnu.org (full text, mbox):
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
> browse-url-of-dired-file should respect directory symlinks.
> E.g.,
> $ emacs -q
> C-x d /cf/updates/
> SPC SPC SPC
> M-x browse-url-of-dired-file
> should call the browser on
> file:///cf/updates/52.html
> not the absolute path
> file:///mnt/usb/cf/updates/52.html
So /cf is a symlink in your setup?
The reason for this behaviour is a patch from 2011 which attempted to
make this command work on the "." and ".." directories:
(let ((tem (dired-get-filename t t)))
(if tem
(browse-url-of-file (expand-file-name tem))
So we want to call with (browse-url-of-file "/") instead of
(browse-url-of-file "/tmp/.."), for instance, and use expand-file-name
to achieve that. However, that function also resolves any symlinks...
This function just needs to do the ../. thing. Does Emacs have a
function that just does the right thing the ".." and "/" and does
absolutely nothing else?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Mon, 20 Jul 2020 14:55:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 39349 <at> debbugs.gnu.org (full text, mbox):
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
LI> So /cf is a symlink in your setup?
Yup.
LI> This function just needs to do the ../. thing. Does Emacs have a
LI> function that just does the right thing the ".." and "/" and does
LI> absolutely nothing else?
Not sure.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Thu, 23 Jul 2020 14:06:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 39349 <at> debbugs.gnu.org (full text, mbox):
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
> LI> This function just needs to do the ../. thing. Does Emacs have a
> LI> function that just does the right thing the ".." and "/" and does
> LI> absolutely nothing else?
>
> Not sure.
I couldn't find one, either.
Eli, the use case here is that we don't want to chase/resolve symlinks,
but we do want to have "/foo/bar/." -> "/foo/bar" and "/foo/bar/.." ->
"/foo". Do you know whether such a utility function exists, by any
chance? If not, would it make sense to add such a function? (For all
other file names, the function would just return the parameter as is.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Thu, 23 Jul 2020 14:20:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 39349 <at> debbugs.gnu.org (full text, mbox):
On Jul 23 2020, Lars Ingebrigtsen wrote:
> Eli, the use case here is that we don't want to chase/resolve symlinks,
> but we do want to have "/foo/bar/." -> "/foo/bar" and "/foo/bar/.." ->
> "/foo".
Isn't that what expand-file-name does?
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Thu, 23 Jul 2020 14:33:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 39349 <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> On Jul 23 2020, Lars Ingebrigtsen wrote:
>
>> Eli, the use case here is that we don't want to chase/resolve symlinks,
>> but we do want to have "/foo/bar/." -> "/foo/bar" and "/foo/bar/.." ->
>> "/foo".
>
> Isn't that what expand-file-name does?
No, it resolves symlinks:
---
Convert filename NAME to absolute, and canonicalize it.
---
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Thu, 23 Jul 2020 14:34:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 39349 <at> debbugs.gnu.org (full text, mbox):
On Jul 23 2020, Lars Ingebrigtsen wrote:
> Andreas Schwab <schwab <at> linux-m68k.org> writes:
>
>> On Jul 23 2020, Lars Ingebrigtsen wrote:
>>
>>> Eli, the use case here is that we don't want to chase/resolve symlinks,
>>> but we do want to have "/foo/bar/." -> "/foo/bar" and "/foo/bar/.." ->
>>> "/foo".
>>
>> Isn't that what expand-file-name does?
>
> No, it resolves symlinks:
No, that's what file-truename does.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Thu, 23 Jul 2020 14:41:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 39349 <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> On Jul 23 2020, Lars Ingebrigtsen wrote:
>
>> Andreas Schwab <schwab <at> linux-m68k.org> writes:
>>
>>> On Jul 23 2020, Lars Ingebrigtsen wrote:
>>>
>>>> Eli, the use case here is that we don't want to chase/resolve symlinks,
>>>> but we do want to have "/foo/bar/." -> "/foo/bar" and "/foo/bar/.." ->
>>>> "/foo".
>>>
>>> Isn't that what expand-file-name does?
>>
>> No, it resolves symlinks:
>
> No, that's what file-truename does.
Oh, yeah; sorry. Thanks.
Then... I don't know what Dan is reporting here. :-/
I've now set up a proper test case, and I can't reproduce the bug, Dan.
Could you explain more closely what you're seeing and what you're
expecting to see?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Thu, 30 Jul 2020 12:48:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 39349 <at> debbugs.gnu.org (full text, mbox):
LI> Then... I don't know what Dan is reporting here. :-/
LI> I've now set up a proper test case, and I can't reproduce the bug, Dan.
LI> Could you explain more closely what you're seeing and what you're
LI> expecting to see?
$ ls -ogd /cf
lrwxrwxrwx 1 11 2016-12-24 /cf -> /mnt/usb/cf
$ ls -ogd /cf/updates
drwxr-xr-x 49 37888 07-30 19:00 /cf/updates
$ ls -ogd /cf/updates/0952053635.html
-rw------- 1 784 2017-12-15 /cf/updates/0952053635.html
$ chromium /cf/updates/0952053635.html # Browses file:///mnt/usb/cf/updates/0952053635.html as seen in the URL bar
$ chromium file:///cf/updates/0952053635.html # Browses file:///cf/updates/0952053635.html as seen in the URL bar
$ w3m /cf/updates/0952053635.html # Browses file:///cf/updates/0952053635.html as seen with the "=" command
$ w3m file:///cf/updates/0952053635.html # Browses file:///cf/updates/0952053635.html as seen with the "=" command
(Firefox acts like chromium.)
$ emacs /cf/updates
then there do browse-url-of-dired-file on 0952053635.html
Well that calls chromium or emacs-w3m on
file:///mnt/usb/cf/updates/0952053635.html
as seen in chromium's URL bar, or emacs-w3m's "c" or "=" commands.
Anyways, I'm saying that the user doesn't want to be made forcibly aware
of the real URL. So browse-url-of-dired-file should probably put a
"file://" in front of what "0 w" (w runs the command dired-copy-filename-as-kill)
returns, when invoking the browser.
0 w (0 dired-copy-filename-as-kill) uses the symlink path reliably.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Fri, 31 Jul 2020 02:49:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 39349 <at> debbugs.gnu.org (full text, mbox):
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
> $ emacs /cf/updates
> then there do browse-url-of-dired-file on 0952053635.html
>
> Well that calls chromium or emacs-w3m on
> file:///mnt/usb/cf/updates/0952053635.html
> as seen in chromium's URL bar, or emacs-w3m's "c" or "=" commands.
I've now tried reproducing this bug in both emacs-26.3 and 28.1, and I'm
unable to. My setup isn't identical to yours, but I'm also using
symlinks to directories, and the symlinked form is always passed to the
browser as is without dereferencing.
Are you seeing this problem if you start emacs with -Q and just
(setq browse-url-browser-function 'browse-url-chromium)
?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Fri, 31 Jul 2020 11:59:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 39349 <at> debbugs.gnu.org (full text, mbox):
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
LI> Are you seeing this problem if you start emacs with -Q and just
LI> (setq browse-url-browser-function 'browse-url-chromium)
LI> ?
Indeed, doing that setq makes all the difference.
With identical runs of
$ emacs -nw -Q /cf/updates
apparently without that setq, BROWSER=chromium gets invoked via the
shell or something, causing the guts of the URL to show.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Fri, 31 Jul 2020 12:05:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 39349 <at> debbugs.gnu.org (full text, mbox):
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
>>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> LI> Are you seeing this problem if you start emacs with -Q and just
>
> LI> (setq browse-url-browser-function 'browse-url-chromium)
>
> LI> ?
>
> Indeed, doing that setq makes all the difference.
> With identical runs of
> $ emacs -nw -Q /cf/updates
> apparently without that setq, BROWSER=chromium gets invoked via the
> shell or something, causing the guts of the URL to show.
Ah! Now I can reproduce it, too, by just not setting
browse-url-browser-function at all.
In my case, that means that
xdg-open file:///tmp/foo/a.html
but xdg-open then rewrites the URL to chase links before handing it over
to the browser.
*phew* :-)
But that does mean that this isn't an Emacs bug, so I'm closing this bug
report. You may want to take up up with whoever is responsible for
xdg-open, perhaps... Or just set the variable.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) notabug.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 31 Jul 2020 12:05:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
39349 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 31 Jul 2020 12:05:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39349
; Package
emacs
.
(Fri, 31 Jul 2020 16:15:01 GMT)
Full text and
rfc822 format available.
Message #45 received at 39349 <at> debbugs.gnu.org (full text, mbox):
OK, filed https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/176 .
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 29 Aug 2020 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 234 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.