rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.15k stars 886 forks source link

`rustup doc` command opens an instance of balenaEtcher #3293

Closed dpensi closed 11 months ago

dpensi commented 1 year ago

Problem

Screencast from 03-29-2023 06:35:30 PM.webm

If balenaEtcher is installed the command rustup doc opens an instance of it instead of opening the docs as shown in the video

Steps

  1. install balenaEtcher
  2. install rust following this instructions, select the default installation (press 1 when prompted)
  3. launch rustup doc

Possible Solution(s)

No response

Notes

$ uname -a
Linux fedora 6.2.7-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Mar 17 16:53:15 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Rustup version

rustup 1.25.2 (17db695f1 2023-02-01)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.68.2 (9eb3afe9e 2023-03-27)`

Installed toolchains

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/dpensier/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.68.2 (9eb3afe9e 2023-03-27)
drulum commented 1 year ago

I've just confirmed the problem using Debian Bullseye Gnome with Balena Etcher installed. I've checked that the default application for web is set to Firefox.

I get the same issue with: cargo doc --open

geoma76 commented 11 months ago

same here. Ubuntu 22.04 with installed Balena Etcher. Default app for web is Firefox. rustc Version 1.73

I used cargo doc --open

djc commented 11 months ago

I'm guessing there is an issue with your mime types associations:

https://wiki.debian.org/MimeTypesSupport

Maybe have a look at what mime types Balena Etcher claims support for? I think it's pretty unlikely that this is a rustup bug, though. We use opener::open_browser() which just opens the app associated with .html files by default, and obeys the BROWSER environment variable (which I'm guessing Balena Etcher does not set).

geoma76 commented 11 months ago

I'm guessing there is an issue with your mime types associations:

https://wiki.debian.org/MimeTypesSupport

Maybe have a look at what mime types Balena Etcher claims support for? I think it's pretty unlikely that this is a rustup bug, though. We use opener::open_browser() which just opens the app associated with .html files by default, and obeys the BROWSER environment variable (which I'm guessing Balena Etcher does not set).

don't think so. For example npm run dev for nuxt or in general npm/node.js opens a Firefox tab without any issue on that system. Just checked it again a minute ago. Double clicking on a .html file in the file explorer opens Firefox, too. So I think my associations should be okay.

geoma76 commented 11 months ago

okay, got it! @djc : you were right! it WAS a missconfigured .html association. But only for local .html. And the configuration in the Gnome settings were still showing "Firefox" as the standard. On a hunch I set the configuration to another browser, saved it and went back to "Firefox" -> cargo doc was working after that. Then I re-opened balena etcher and voila: same problem again. So definitely not a problem of rust... Thanks for the push in the right direction!

djc commented 11 months ago

Basically, we'll execute xdg-open ~/.rustup/toolchains/stable-aarch64-apple-darwin/share/doc/rust/html/index.html (likely with a different target, of course) if xdg-open exists (which I'm guessing it does in your case?) or otherwise does some other stuff with sh -s.

I'm going to close this for now, I don't think the problem is with rustup in this case.