-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc output directory structure leaks home directory structure #18370
Comments
Before: doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html After: doc/src/collections/vec.rs.html If the source code is in the parent dirs relative to the crate root, `..` is replaced with `up` as expected. Any other error like non-UTF-8 paths or drive-relative paths falls back to the absolute path. There might be a way to improve on false negatives, but this alone should be enough for fixing rust-lang#18370.
…excrichton Before: `doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html` After: `doc/src/collections/vec.rs.html` If the source code is in the parent dirs relative to the crate root, `..` is replaced with `up` as expected. Any other error like non-UTF-8 paths or drive-relative paths falls back to the absolute path. There might be a way to improve on false negatives, but this alone should be enough for fixing #18370.
I think this is fixed by #19436. |
Thanks @lifthrasiir! |
Thanks @lifthrasiir ! |
This appears to be a problem again. I'm seeing stuff like <a class='srclink' href='../../src/msfs/home/snek/Desktop/projects/msfs-rs/target/debug/build/msfs-7d0246a486c664b1/out/bindings.rs.html#3101' title='goto source code'>[src]</a> in my output. |
That looks like it's specific to files generated by build scripts, I haven't seen it for most pages. |
Isn't it possible only for local builds? On docs.rs and hosted docs, it shouldn't be possible, no? |
Hmm, I thought it was possible on docs.rs, but looking at https://docs.rs/zstd-sys/1.4.17+zstd.1.4.5/zstd_sys/struct.ZSTD_DDict_s.html it looks like the file path is not leaked. I could have sworn I'd seen this on docs.rs before, though. |
What does docs.rs do differently so that this doesn't occur? @GuillaumeGomez |
Triage: This is happening on docs.rs too: https://docs.rs/mbedtls-sys-auto/2.26.0/src/mbedtls_sys/opt/rustwide/target/debug/build/mbedtls-sys-auto-bbf58e089d61f478/out/bindings.rs.html |
I'm not sure this is rustdoc's fault - it does the same thing for build scripts as for anything else: rust/src/librustdoc/html/sources.rs Line 48 in 010c236
Maybe there's some bug in span_to_filename ? rust/compiler/rustc_span/src/source_map.rs Lines 473 to 475 in 010c236
|
feat: resolve range patterns to their structs Closes rust-lang#18367
Since Rust-CI has been continuously failing I've been looking to move my docs to GitHub Pages. This led me to notice that when
rustdoc
is called with an absolute path as input (ascargo
does) the files in doc/src will show your entire home directory layout.This is problematic not only because of the leak of someone's home directory layout, but because those links will break if I build from a new directory, a new computer, and a different contributor commits those changes. Also if you have 2+ contributors you're going to have massive churn on a repo checking in those files. Least importantly the URLs are ugly when clicking on a src link. :)
As an example on Rust's own API docs, If you click the [src] link on http://doc.rust-lang.org/std/vec/ you end up at http://doc.rust-lang.org/src/collections/home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcollections/vec.rs.html#11-2901
The text was updated successfully, but these errors were encountered: