Problem you are trying to solve
rustup doc currently opens the local Rust documentation using the system's default browser.
On Ubuntu, if the default browser is a sandboxed browser (such as the Snap packages of Brave or Firefox), the browser may be unable to access the documentation stored under ~/.rustup via a file:// URL. From the user's perspective, rustup doc appears to fail and the browser only displays an "Access denied" or similar error.
This appears to be caused by the browser's sandbox rather than a bug in rustup. However, the current experience is confusing because users receive no indication that the failure is caused by browser restrictions or what they can do instead.
Solution you'd like
Ideally, rustup doc could provide a more helpful experience when the local documentation cannot be opened.
Some possible approaches (not prescriptive) are:
- Detect when opening the documentation fails and print a message explaining that sandboxed browsers (such as Snap or Flatpak packages) may not be able to access documentation stored under
~/.rustup.
- Suggest a workaround, such as using the online documentation or serving the local documentation over HTTP.
- If feasible, consider providing an option to serve the documentation locally instead of relying on
file:// URLs.
I don't have a specific implementation in mind. The main goal is to make it easier for users to understand why rustup doc did not work and how they can access the documentation.
Notes
Environment
- Ubuntu
- Rust installed via
rustup
- Reproduced with the Snap versions of both Brave (default browser) and Firefox
Reproduction
The browser fails to open the local documentation, reporting an access denied error.
Investigation
The documentation exists and is readable. Copying it outside ~/.rustup allows it to open normally, which suggests the issue is due to browser sandbox restrictions on file:// access rather than the documentation itself.
Current workaround
Serve the documentation over a local HTTP server:
cd ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html
python3 -m http.server 8000
Then open:
Problem you are trying to solve
rustup doccurrently opens the local Rust documentation using the system's default browser.On Ubuntu, if the default browser is a sandboxed browser (such as the Snap packages of Brave or Firefox), the browser may be unable to access the documentation stored under
~/.rustupvia afile://URL. From the user's perspective,rustup docappears to fail and the browser only displays an "Access denied" or similar error.This appears to be caused by the browser's sandbox rather than a bug in
rustup. However, the current experience is confusing because users receive no indication that the failure is caused by browser restrictions or what they can do instead.Solution you'd like
Ideally,
rustup doccould provide a more helpful experience when the local documentation cannot be opened.Some possible approaches (not prescriptive) are:
~/.rustup.file://URLs.I don't have a specific implementation in mind. The main goal is to make it easier for users to understand why
rustup docdid not work and how they can access the documentation.Notes
Environment
rustupReproduction
The browser fails to open the local documentation, reporting an access denied error.
Investigation
The documentation exists and is readable. Copying it outside
~/.rustupallows it to open normally, which suggests the issue is due to browser sandbox restrictions onfile://access rather than the documentation itself.Current workaround
Serve the documentation over a local HTTP server:
Then open: