Using help on a builtin command dies when trying to send you to an html page #342

Closed
Soares opened this Issue Oct 15, 2012 · 17 comments

Comments

Projects
None yet
7 participants
@Soares
Contributor

Soares commented Oct 15, 2012

I'm brand new to fish. As a dvorak user I wanted to rebind Crtl-F to something a bit easier to type. So I type help bind, and get:

So8res ~> help bind
Warning: unknown mime-type for "/usr/local/share/doc/fish/commands.html#bind" -- using "application/octet-stream"
Error: no such file "/usr/local/share/doc/fish/commands.html#bind"

The file /usr/local/share/doc/fish/commands.html definitely exists, it looks like the hash is throwing off python's webserver.open(), which is grabbing google-chrome, as it were.

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Oct 16, 2012

Member

I think you mean webbrowser.open.

It's surprising that webbrowser.open is being invoked...that's not fish doing that. Do you have a value set for $BROWSER? (Run echo $BROWSER).

Probably this is something weird that xdg-open is doing. What happens if you run xdg-open with that path?

Member

ridiculousfish commented Oct 16, 2012

I think you mean webbrowser.open.

It's surprising that webbrowser.open is being invoked...that's not fish doing that. Do you have a value set for $BROWSER? (Run echo $BROWSER).

Probably this is something weird that xdg-open is doing. What happens if you run xdg-open with that path?

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Oct 16, 2012

Member

Portably opening a URL is needlessly difficult.

Member

ridiculousfish commented Oct 16, 2012

Portably opening a URL is needlessly difficult.

@Soares

This comment has been minimized.

Show comment
Hide comment
@Soares

Soares Oct 16, 2012

Contributor

Hah, so it seems. My $BROWSER is set right, and I did mean webbrowser.open, nice catch. And yes, it appears that it's not fish's fault -- xdg-open chokes when I try to open the file with the hash fragment. It seems to be naively looking for a ".html#bind" filetype. I tried passing it file:///usr/local/share/doc/fish/commands.html#bind but it couldn't handle that either :(

Contributor

Soares commented Oct 16, 2012

Hah, so it seems. My $BROWSER is set right, and I did mean webbrowser.open, nice catch. And yes, it appears that it's not fish's fault -- xdg-open chokes when I try to open the file with the hash fragment. It seems to be naively looking for a ".html#bind" filetype. I tried passing it file:///usr/local/share/doc/fish/commands.html#bind but it couldn't handle that either :(

@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Oct 17, 2012

Member

See also:

Hilariously the result is different - for me at least - between xdg-open somefile.html#target (opens somefile.html but not at a target) and xdg-open "somefile.html#target" (error as above).

Member

zanchey commented Oct 17, 2012

See also:

Hilariously the result is different - for me at least - between xdg-open somefile.html#target (opens somefile.html but not at a target) and xdg-open "somefile.html#target" (error as above).

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Oct 17, 2012

Member

Nice find zanchey.

I wonder if we can detect the buggy xdg-open and work around it.

Member

ridiculousfish commented Oct 17, 2012

Nice find zanchey.

I wonder if we can detect the buggy xdg-open and work around it.

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Jan 12, 2013

Member

I'm revisiting this, and unable to reproduce it. help bind works correctly. xdg_open --version reports 1.0.2. Do you still see this?

Member

ridiculousfish commented Jan 12, 2013

I'm revisiting this, and unable to reproduce it. help bind works correctly. xdg_open --version reports 1.0.2. Do you still see this?

@Soares

This comment has been minimized.

Show comment
Hide comment
@Soares

Soares Oct 28, 2013

Contributor

wfm, closing.

Contributor

Soares commented Oct 28, 2013

wfm, closing.

@Soares Soares closed this Oct 28, 2013

@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Oct 29, 2013

Member

Interestingly, I don't see this on Ubuntu with xdg-utils 1.1.0rc1-2ubuntu7 (xdg-open version 1.0.2), but it's present on Debian with xdg-utils 1.1.0rc1+git20111210-6 (xdg-open version 1.1.0 rc1).

Member

zanchey commented Oct 29, 2013

Interestingly, I don't see this on Ubuntu with xdg-utils 1.1.0rc1-2ubuntu7 (xdg-open version 1.0.2), but it's present on Debian with xdg-utils 1.1.0rc1+git20111210-6 (xdg-open version 1.1.0 rc1).

@dontdieych

This comment has been minimized.

Show comment
Hide comment
@dontdieych

dontdieych Feb 1, 2014

Manjaro(Arch) user here. same problem

➜ ~ help bind
xdg-open: file '/usr/share/doc/fish/commands.html#bind' does not exist
➜ ~ xdg-open --version
xdg-open 1.1.0 rc1
➜ ~ fish --version
fish, version 2.1.0
➜ ~ set|ag BROW
BROWSER /usr/bin/xdg-open

Manjaro(Arch) user here. same problem

➜ ~ help bind
xdg-open: file '/usr/share/doc/fish/commands.html#bind' does not exist
➜ ~ xdg-open --version
xdg-open 1.1.0 rc1
➜ ~ fish --version
fish, version 2.1.0
➜ ~ set|ag BROW
BROWSER /usr/bin/xdg-open

@zanchey zanchey reopened this Feb 2, 2014

@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Feb 3, 2014

Member

gvfs-open handles the URL just fine, so if you have GNOME installed then this bug disappears. Presumably the same with KDE, LXDE, etc.

Member

zanchey commented Feb 3, 2014

gvfs-open handles the URL just fine, so if you have GNOME installed then this bug disappears. Presumably the same with KDE, LXDE, etc.

@cben

This comment has been minimized.

Show comment
Hide comment
@cben

cben May 9, 2015

Contributor

For me on Lubuntu 15.04 help for is still broken.
I have gvfs-open installed but just having it doesn't automagically help (perhaps because I'm running LXDE rather than Gnome session?).
In any case,

gvfs-open 'file:///usr/share/doc/fish/commands.html#for'

works while

gvfs-open '/usr/share/doc/fish/commands.html#for'

fails.
Same is true for sensible-browser though for different reason: without file:// prefix it takes # to be part of the filename (opening file:///usr/share/doc/fish/commands.html%23for) but with file:// prefix it takes it as hash fragment.

Perhaps we can amend help to try gvfs-open and/or sensible-browser in preference to xdg-open?

Contributor

cben commented May 9, 2015

For me on Lubuntu 15.04 help for is still broken.
I have gvfs-open installed but just having it doesn't automagically help (perhaps because I'm running LXDE rather than Gnome session?).
In any case,

gvfs-open 'file:///usr/share/doc/fish/commands.html#for'

works while

gvfs-open '/usr/share/doc/fish/commands.html#for'

fails.
Same is true for sensible-browser though for different reason: without file:// prefix it takes # to be part of the filename (opening file:///usr/share/doc/fish/commands.html%23for) but with file:// prefix it takes it as hash fragment.

Perhaps we can amend help to try gvfs-open and/or sensible-browser in preference to xdg-open?

@faho

This comment has been minimized.

Show comment
Hide comment
@faho

faho Aug 24, 2015

Member

@cben: Is this an issue with fish 2.2.0? It uses the "file://" prefix so it should work.

Member

faho commented Aug 24, 2015

@cben: Is this an issue with fish 2.2.0? It uses the "file://" prefix so it should work.

@faho

This comment has been minimized.

Show comment
Hide comment
@faho

faho Sep 15, 2015

Member

I'm now assuming this is fixed since we use the "file://" prefix.

Member

faho commented Sep 15, 2015

I'm now assuming this is fixed since we use the "file://" prefix.

@faho faho closed this Sep 15, 2015

@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Oct 15, 2015

Member

It actually doesn't work, even in 2.2.0 - but xdg-open is at fault, not fish. I don't think checking for gvfs-open is wise as that may be present on systems even if you are not running GNOME, but sensible-browser is a good idea as that will work on all Debian-derived systems.

Member

zanchey commented Oct 15, 2015

It actually doesn't work, even in 2.2.0 - but xdg-open is at fault, not fish. I don't think checking for gvfs-open is wise as that may be present on systems even if you are not running GNOME, but sensible-browser is a good idea as that will work on all Debian-derived systems.

@zanchey zanchey reopened this Oct 15, 2015

@zanchey zanchey self-assigned this Oct 15, 2015

@cben

This comment has been minimized.

Show comment
Hide comment
@cben

cben Dec 6, 2015

Contributor

Still a problem. Now on Lubuntu 15.10, fish 2.2.0-2, xdg-utils 1.1.0~rc3+git2015090.
strace confirms fish executes:

30708 execve("/usr/bin/xdg-open", ["xdg-open", "file:///usr/share/doc/fish/commands.html#bind"], [/* 73 vars */] <unfinished ...>

For me (LXDE desktop), this opens file browser at / dir.
Without #bind it does open the browser (but obviously doesn't scroll to the specific command).
gvfs-open, gnome-open and sensible-browser all work correctly with #bind.

A quick search suggest the closest reported xdg-open bug was https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800355 , fixed by http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=5f6e3b328a1f3ccb6ec61b0193eac3e09309fcf5
Running xdg-open from git HEAD opens commands.html (without #bind) in my Chromium.
Which is progress but not perfect.

Contributor

cben commented Dec 6, 2015

Still a problem. Now on Lubuntu 15.10, fish 2.2.0-2, xdg-utils 1.1.0~rc3+git2015090.
strace confirms fish executes:

30708 execve("/usr/bin/xdg-open", ["xdg-open", "file:///usr/share/doc/fish/commands.html#bind"], [/* 73 vars */] <unfinished ...>

For me (LXDE desktop), this opens file browser at / dir.
Without #bind it does open the browser (but obviously doesn't scroll to the specific command).
gvfs-open, gnome-open and sensible-browser all work correctly with #bind.

A quick search suggest the closest reported xdg-open bug was https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800355 , fixed by http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=5f6e3b328a1f3ccb6ec61b0193eac3e09309fcf5
Running xdg-open from git HEAD opens commands.html (without #bind) in my Chromium.
Which is progress but not perfect.

@zanchey zanchey removed their assignment Dec 3, 2016

@krader1961 krader1961 added the bug label Mar 13, 2017

@krader1961

This comment has been minimized.

Show comment
Hide comment
@krader1961

krader1961 Mar 13, 2017

Contributor

Closing since this is a bug in an external command and it's been 4.5 years since the issue was reported and no one cared enough to implement a workaround.

Contributor

krader1961 commented Mar 13, 2017

Closing since this is a bug in an external command and it's been 4.5 years since the issue was reported and no one cared enough to implement a workaround.

@krader1961 krader1961 closed this Mar 13, 2017

@krader1961 krader1961 added enhancement and removed bug labels Mar 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment