Skip to content
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 slightly nondeterministic #24473

Closed
sfackler opened this issue Apr 15, 2015 · 10 comments · Fixed by #35984
Closed

Rustdoc output slightly nondeterministic #24473

sfackler opened this issue Apr 15, 2015 · 10 comments · Fixed by #35984
Labels
A-reproducibility Area: Reproducible / deterministic builds C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@sfackler
Copy link
Member

There's a bit of nondeterminism in rustdoc output across runs even when the source doesn't change: sfackler/rust-openssl@1cb83ff I'm guessing it's due to randomized HashMap iteration order.

It'd be nice to switch to a non keyed Hasher or maybe just TreeMaps in rustdoc to avoid "phantom" documentation updates.

@sfackler sfackler added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 15, 2015
@ghost
Copy link

ghost commented Apr 15, 2015

May be as easy as changing HashMap to rustc::util::FnvHashMap in https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/render.rs.

@ghost ghost added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Apr 15, 2015
@Gankra
Copy link
Contributor

Gankra commented Apr 16, 2015

Using @jakub-'s solution barring catastrophe

steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 16, 2015
…xcrichton

This ensures that later when generating HTML, the JSON will be sorted aswell.
We now have a more deterministic build of sidebar-items.js

Closes rust-lang#24473
Manishearth added a commit to Manishearth/rust that referenced this issue Apr 17, 2015
…xcrichton

 This ensures that later when generating HTML, the JSON will be sorted aswell.
We now have a more deterministic build of sidebar-items.js

Closes rust-lang#24473
@bors bors closed this as completed in 89bfacc Apr 17, 2015
@sfackler
Copy link
Member Author

This still appears to be present in other contexts than the one that was fixed: sfackler/rust-openssl@bca2a36

@sfackler sfackler reopened this May 13, 2015
@sfackler sfackler removed the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label May 13, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue May 8, 2016
rustdoc: use btree map for where clauses

to get more reproducible output.

Fixes: rust-lang#32555

I've looked at the other uses of HashMap in rustdoc, and they seem ok to (i.e. they use `iter()` and related only for constructing a new map, or when the output goes into independent files).

Not sure what the cause of rust-lang#24473 is, it shouldn't be where clauses, but maybe it was also fixed inbetween since May 2015.
Manishearth added a commit to Manishearth/rust that referenced this issue May 8, 2016
rustdoc: use btree map for where clauses

to get more reproducible output.

Fixes: rust-lang#32555

I've looked at the other uses of HashMap in rustdoc, and they seem ok to (i.e. they use `iter()` and related only for constructing a new map, or when the output goes into independent files).

Not sure what the cause of rust-lang#24473 is, it shouldn't be where clauses, but maybe it was also fixed inbetween since May 2015.
bors added a commit that referenced this issue Aug 28, 2016
Steps towards reproducible builds

cc #34902

Running `make dist` twice will result in a rustc tarball where only `librustc_back.so`, `librustc_llvm.so` and `librustc_trans.so` differ. Building `libstd` and `libcore` twice with the same compiler and flags produces identical artifacts.

The third commit should close #24473
bors added a commit that referenced this issue Aug 28, 2016
Steps towards reproducible builds

cc #34902

Running `make dist` twice will result in a rustc tarball where only `librustc_back.so`, `librustc_llvm.so` and `librustc_trans.so` differ. Building `libstd` and `libcore` twice with the same compiler and flags produces identical artifacts.

The third commit should close #24473
@est31
Copy link
Member

est31 commented May 13, 2017

PR #35984 has been first included in the 1.13 release. Still, in 1.14 there is some non-determinism left, inside the search index. See this diffoscope output.

I think the issue is that the search index gets sorted by the order in which rustdoc finishes the build of the crates. We'd need a better mechanism in order to get determinism. Maybe a final pass to sort by the crate name?

@eddyb eddyb reopened this May 13, 2017
@est31
Copy link
Member

est31 commented May 13, 2017

Hmm, as of 1.14 it didn't sort, but since PR #38105 which was first included in 1.15, it does sort. So this sub-issue can be viewed as fixed.

@frewsxcv frewsxcv added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@kzys
Copy link
Contributor

kzys commented Aug 22, 2018

Yep. I couldn't reproduce the issue on master (786ccc3).

The only concern I have is that tests.reproducible-builds.org still shows rust-​doc_1.​28.​0+dfsg1-​2_all.​deb is different.
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/arm64/diffoscope-results/rustc.html

@kzys
Copy link
Contributor

kzys commented Sep 18, 2018

Nevermind. Seems searchindex.js is still having an issue.

https://tests.reproducible-builds.org/debian/rb-pkg/buster/amd64/diffoscope-results/rustc.html

@kzys
Copy link
Contributor

kzys commented Sep 27, 2018

searchindex.js is generated by mdbook, not rustdoc. I think we can close this issue.

@mnd
Copy link
Contributor

mnd commented Oct 11, 2018

@kzys Issue from 1.28.0 release already solved in rust-lang/mdBook#692
Currently I working on Rust 1.28.0 package for GuixSD and without rust-lang/mdBook#692 patch I got same reproducibility issue.

@kzys
Copy link
Contributor

kzys commented Oct 11, 2018

Awesome! I am not sure how Debian gets docs, but maybe we need to upgrade mdbook here?

version = "0.1.7"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-reproducibility Area: Reproducible / deterministic builds C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants