Rustup doc opens Signal instead of the browser

I'm using Ubuntu 19.10 and I have the Signal messenger desktop application installed.

I have installed rustup yesterday, by following the steps in "the book".

When I run rustup doc or rustup doc --book, instead of getting the documentation in my browser (or whatever is supposed to happen), my Signal opens up (and does nothing).

I suspect this is not an issue with rustup itself, but rather some misconfiguration on my machine, possibly introduced by Signal. However, I'm not sure where to investigate.

Did this happen to anyone? Any idea what I should check?

If you go into system settings, I think there should be a "Default Applications" item - it might be under "About" in some versions, but I can't remember the exact ones as I'm not running Ubuntu atm. If you go in there, is Signal set as your browser/web application? Could you change it to your browser instead?

Might not be the problem, but it could be one good place to start if you haven't already checked?

1 Like

I just checked, it looks correct:

  • in "Settings / Details / Default Applications", for "Web" I have "Firefox Web Browser"
  • in "Settings / Applications / Signal" I have the "Default Handlers" section, where Signal is associated with opening "sgnl Links" (sgnl://).

Hmm, weird.

From the rust source, it seems like it uses the opener library to open rustdoc urls (I assume rustup does the same?).

The opener library is then documented to use an library version of xdg-open embedded into the binary. If you copy a URL like file:///home/daboross/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/rust/html/index.html and run

xdg-open file:///home/daboross/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/doc/rust/html/index.html

Does it open in signal as well?

If so, I think we might be able to debug this further - or at least have a lead on further things that could be going wrong. (or at least a minimal bug report that doesn't depend on rust?)

1 Like

FWIW, I have Signal installed here on Manjaro and no problem here. rustup doc opens in Firefox. So it must be something distro-specific.

Edit: In light of the new information revealed below, it probably doesn't affect me because the OS is a fresh install as of a few weeks ago, so I didn't have stale XDG settings to fix.

I've had this exact problem in the past. In my case, the Arch Linux install of Signal would set itself as the default application for HTML.

From memory, you can check and change which application will be used with xdg-mime query default text/html and set it using something like xdg-mime default firefox.desktop text/html.

I also used strace and saw it making edits to ~/.config/mineapps.list. I believe this is the main config file used by xdg-open (which is used by opener and similar crates on Linux).

2 Likes

Thanks a lot for the hint with xdg-open! That pushed me into the right direction.
Also, I liked the explanation of what Rust does to open links. :+1:

I tried your recommendation and ran:

xdg-open /home/cosmin/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/index.html

It opened in Signal.

Then I wondered, would any HTML file open in Signal, from anywhere? I tried to open one from Nautilus (the file manager) and the same thing happened. I haven't noticed that before.

Looking around in the help and manual of xdg-open, I found out about xdg-mime.
I ran:

$ xdg-mime query filetype /home/cosmin/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/index.html
text/html

Then:

$ xdg-mime query default text/html
signal-desktop.desktop

So that was the problem. I searched on the web for "signal xdg mime" and found an issue for Signal Desktop for this exact problem: Do not register signal-desktop.desktop as handler for text/html
As they mention it there, it's already fixed in the recent versions, but one has to repair the configuration manually:

xdg-mime default firefox.desktop text/html

I did that and now everything's back to normal. I can see the Rust documentation. :partying_face:

5 Likes