Skip to content

docs.rs should ignore rust-toolchain #555

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

Closed
eldesh opened this issue Jan 8, 2020 · 7 comments · Fixed by #1371
Closed

docs.rs should ignore rust-toolchain #555

eldesh opened this issue Jan 8, 2020 · 7 comments · Fixed by #1371
Labels
C-bug Category: This is a bug C-build-failure Category: This is a crate that failed to build E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started

Comments

@eldesh
Copy link

eldesh commented Jan 8, 2020

dockworker which is a docker client library.
Building this crate failed on docs.rs :(

Crate name:
dockworker

Build failure link:
https://docs.rs/crate/dockworker/0.0.15

Additional details:
On my local machine (Ubuntu 18.04 LTS), building succeeds.

@eldesh eldesh added the C-build-failure Category: This is a crate that failed to build label Jan 8, 2020
@pietroalbini pietroalbini added E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started labels Jan 8, 2020
@pietroalbini
Copy link
Member

Seems like the rust-toolchain in the source code is present, asking rustup to install 1.32.0 instead of the nightly used by docs.rs. This is not your crate's fault, docs.rs should remove that file.

Writing mentoring instructions if anyone wants to fix this issue:


To fix this issue, a new prepare step to remove that file from the source directory should be added to rustwide, before the manifest is read. In addition to that, a rustwide buildtest needs to be added: create a dummy crate in rustwide's tests/buildtest/crates with a rust-toolchain file in it pointing to a really old version (like 1.0.0), and create a test that calls rustc --version and ensures it's not actually 1.0.0.

Once rustwide is updated and a new version is released you should open a PR to docs.rs bumping rustwide.

If anyone wants to work on this issue please say so in the comments, so we don't have multiple people working on the same issue. If you need help implementing it feel free to comment here or hop on Discord (channel #docs-rs). Check out the contributing guidelines as well!

@jyn514 jyn514 changed the title Build failure: latest dockworker docs.rs should ignore rust-toolchain Mar 21, 2020
@Freax13
Copy link

Freax13 commented May 6, 2020

I have trouble implementing the test for this.

I tried

#[test]
fn test_toolchain_override() {
    runner::run("toolchain-override", |run| {
        run.build(SandboxBuilder::new().enable_networking(false), |build| {
            let storage = rustwide::logging::LogStorage::new(LevelFilter::Info);
            rustwide::logging::capture(&storage, || -> Result<_, Error> {
                build.cargo().args(&["rustc", "--", "--version"]).run()?;
                Ok(())
            })?;

            // some check
            Ok(())
        })?;
        Ok(())
    });
}

but this doesn't work because it ignores the rust-toolchain file anyways. I'm not sure what causes rustup to install the new toolchain with docs.rs and not with the test

@jyn514
Copy link
Member

jyn514 commented May 6, 2020

It seems the behavior of docs.rs has changed since the issue was opened.

$ RUST_LOG=info cargo run -q build crate -l ../toolchain-test/
...
2020/05/06 09:21:35 [INFO] rustwide::cmd: running `"/home/joshua/src/rust/docs.rs/.rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--format-version" "1"`
2020/05/06 09:21:35 [INFO] rustwide::cmd: running `"docker" "create" "-v" "/home/joshua/src/rust/docs.rs/.rustwide/builds/toolchain-test-0.1.0/target:/opt/rustwide/target:rw,Z" "-v" "/home/joshua/src/rust/docs.rs/.rustwide/builds/toolchain-test-0.1.0/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/joshua/src/rust/docs.rs/.rustwide/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/joshua/src/rust/docs.rs/.rustwide/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "MAP_USER_ID=1000" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "RUSTFLAGS=" "-e" "RUSTDOCFLAGS=-Z unstable-options --resource-suffix -20200505-1.45.0-nightly-f8d394e51 --static-root-path / --cap-lints warn" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "3221225472" "--network" "none" "rustops/crates-build-env" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "doc" "--lib" "--no-deps" "--target" "x86_64-apple-darwin"`
2020/05/06 09:21:35 [INFO] rustwide::cmd: [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
2020/05/06 09:21:35 [INFO] rustwide::cmd: [stdout] 707d87ecf6f8af1962a614f48d95fb6e771de0c22955053de8fbd605a618795f
2020/05/06 09:21:35 [INFO] rustwide::cmd: running `"docker" "start" "-a" "707d87ecf6f8af1962a614f48d95fb6e771de0c22955053de8fbd605a618795f"`
2020/05/06 09:21:36 [INFO] rustwide::cmd: [stderr] sudo: setrlimit(RLIMIT_CORE): Operation not permitted
2020/05/06 09:21:36 [INFO] rustwide::cmd: [stderr]  Documenting toolchain-test v0.1.0 (/opt/rustwide/workdir)
2020/05/06 09:21:37 [INFO] rustwide::cmd: [stderr]     Finished dev [unoptimized + debuginfo] target(s) in 0.87s
2020/05/06 09:21:37 [INFO] rustwide::cmd: running `"docker" "inspect" "707d87ecf6f8af1962a614f48d95fb6e771de0c22955053de8fbd605a618795f"`
2020/05/06 09:21:37 [INFO] rustwide::cmd: running `"docker" "rm" "-f" "707d87ecf6f8af1962a614f48d95fb6e771de0c22955053de8fbd605a618795f"`
2020/05/06 09:21:37 [INFO] rustwide::cmd: [stdout] 707d87ecf6f8af1962a614f48d95fb6e771de0c22955053de8fbd605a618795f
2020/05/06 09:21:37 [INFO] cratesfyi::docbuilder::rustwide_builder: .rustwide/builds/toolchain-test-0.1.0/target/x86_64-apple-darwin/doc /tmp/docsrs-docs.tXHW1a5ZzcAC/x86_64-apple-darwin
thread 'main' panicked at 'Building documentation failed: ErrorMessage { msg: "Not a JSON object" }', src/bin/cratesfyi.rs:199:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

We'll have to figure out where this new panic is coming from, it only happens in crates with this toolchain error (I checked with target_lexicon 0.10.0 and a custom test that only had default-run = "toolchain-test" in Cargo.toml and 1.34.0 in rust-toolchain).

@Freax13
Copy link

Freax13 commented May 6, 2020

running RUST_BACKTRACE=1 RUST_LOG=info cargo run build crate target-lexicon 0.10.0 works for me

@jyn514
Copy link
Member

jyn514 commented May 6, 2020

Yes I was a little unclear sorry - target-lexicon builds successfully but the toolchain-test crate did not.

@Freax13
Copy link

Freax13 commented May 6, 2020

the error is coming from

.ok_or_else(|| err_msg("Not a JSON object"))?;

@Freax13
Copy link

Freax13 commented May 6, 2020

okay, so for some reason get_release_time_yanked_downloads is called which tries to download the info about toolchain-test from crates.io (https://crates.io/api/v1/crates/toolchain-test/versions).

I'm not sure if this is related to removing the rust-toolchain file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug C-build-failure Category: This is a crate that failed to build E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants