bug#39349: browse-url-of-dired-file should respect directory symlinks

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

積丹尼 Dan Jacobson
>>>>> "LI" == Lars Ingebrigtsen <[hidden email]> 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.



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

Lars Ingebrigtsen
積丹尼 Dan Jacobson <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

Andreas Schwab-2
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, [hidden email]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

Lars Ingebrigtsen
Andreas Schwab <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

Andreas Schwab-2
On Jul 23 2020, Lars Ingebrigtsen wrote:

> Andreas Schwab <[hidden email]> 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, [hidden email]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

Lars Ingebrigtsen
Andreas Schwab <[hidden email]> writes:

> On Jul 23 2020, Lars Ingebrigtsen wrote:
>
>> Andreas Schwab <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

積丹尼 Dan Jacobson
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.



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

Lars Ingebrigtsen
積丹尼 Dan Jacobson <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

積丹尼 Dan Jacobson
>>>>> "LI" == Lars Ingebrigtsen <[hidden email]> 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.



Reply | Threaded
Open this post in threaded view
|

bug#39349: browse-url-of-dired-file should respect directory symlinks

積丹尼 Dan Jacobson