Skip to content

Broken relative link to source file in README #413

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

Open
pickfire opened this issue Sep 23, 2019 · 14 comments
Open

Broken relative link to source file in README #413

pickfire opened this issue Sep 23, 2019 · 14 comments

Comments

@pickfire
Copy link
Contributor

pickfire commented Sep 23, 2019

https://docs.rs/crate/ripgrep/11.0.2

Relative link User Guide points to https://docs.rs/crate/ripgrep/GUIDE.md which does not exist (404).

Instead, it should either points to source/$file with url replacement (

markdown_to_html(text, &options)
) or $file gets redirected to source/$file (somewhere near

docs.rs/src/web/mod.rs

Lines 226 to 232 in 32074e7

let err = if let Some(err) = e.error.downcast::<error::Nope>() {
*err
} else if e.error.downcast::<NoRoute>().is_some() {
error::Nope::ResourceNotFound
} else {
panic!("all cratesfyi errors should be of type Nope");
};
).

So far, I have only seen this bug affecting README.

@jyn514
Copy link
Member

jyn514 commented Nov 26, 2019

@pickfire you mentioned in #200 you were having trouble setting up the site locally. We've since switched to docker and the steps are much easier to reproduce, are you still interested in contributing?

@pickfire
Copy link
Contributor Author

pickfire commented Nov 26, 2019

@jyn514 Yes, thanks for pinging me.

Are there any other solutions other than the proposed method? File replacements does not seemed to be the right thing to do.

@jyn514
Copy link
Member

jyn514 commented Nov 26, 2019

File replacements does not seemed to be the right thing to do.

I agree, comrak doesn't seem to support this so we'd have to parse the links ourselves which I definitely don't want to do.

The redirect idea seems good - some URLs could overlap with existing routes but the only current ones are builds and source, so I doubt anyone would have a file with the same name.

I think you'd want to add a new route near

router.get("/crate/:name/:version/",
, not in the error handling.

@pickfire
Copy link
Contributor Author

@jyn514 Okay, thanks for pointing this out.

@pickfire
Copy link
Contributor Author

pickfire commented Dec 8, 2019

Why do I get nightly compiler not found when running docker-compose run web build crate ripgrep 11.0.2?

Starting docsrs_db_1 ... done

export CRATESFYI_PREFIX=/opt/docsrs/prefix
export DOCS_RS_DOCKER=true
export RUST_LOG=cratesfyi,rustwide=info
export PATH="$PATH:/build/target/release"

# Try migrating the database multiple times if it fails
# This avoids the docker container crashing the first time it's started with
# docker-compose, as PostgreSQL needs some time to initialize.
set +e
failed=0
while true; do
    if ! cratesfyi database migrate; then
        ((failed=failed + 1))
        if [ "${failed}" -eq 5 ]; then
            exit 1
        fi
        echo "failed to migrate the database"
        echo "waiting 1 second..."
        sleep 1
    else
        break
    fi
done
set -e

cratesfyi database update-search-index
cratesfyi database update-release-activity

if ! [ -d "${CRATESFYI_PREFIX}/crates.io-index/.git" ]; then
    git clone https://github.com/rust-lang/crates.io-index "${CRATESFYI_PREFIX}/crates.io-index"
    # Prevent new crates built before the container creation to be built
    git --git-dir="$CRATESFYI_PREFIX/crates.io-index/.git" branch crates-index-diff_last-seen
fi

cratesfyi build add-essential-files --only-first-time
2019/12/08 13:09:49 [INFO] rustwide::cmd::sandbox: pulling image rustops/crates-build-env from Docker Hub
2019/12/08 13:09:49 [INFO] rustwide::cmd: running `"docker" "pull" "rustops/crates-build-env"`
2019/12/08 13:09:49 [INFO] rustwide::cmd: [stdout] Using default tag: latest
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout] latest: Pulling from rustops/crates-build-env
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout] Digest: sha256:80e7928e023b8b3388bc4cec9575e4b5c48dfbb7d5bea91eeeab909cf55d7b92
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout] Status: Image is up to date for rustops/crates-build-env:latest
2019/12/08 13:09:53 [INFO] rustwide::cmd::sandbox: checking the image rustops/crates-build-env is available locally
2019/12/08 13:09:53 [INFO] rustwide::cmd: running `"docker" "image" "inspect" "rustops/crates-build-env"`
2019/12/08 13:09:53 [INFO] rustwide::inside_docker: detecting the ID of the container where rustwide is running
2019/12/08 13:09:53 [INFO] rustwide::inside_docker: probing container id bb148c0155b926bcfd48e12093bf0431bf922d46b3b727f546358b5e4525c3b4
2019/12/08 13:09:53 [INFO] rustwide::inside_docker: probe successful, this is container ID bb148c0155b926bcfd48e12093bf0431bf922d46b3b727f546358b5e4525c3b4
2019/12/08 13:09:53 [INFO] rustwide::inside_docker: inspecting the current container
2019/12/08 13:09:53 [INFO] rustwide::workspace: installing tools required by rustwide
2019/12/08 13:09:53 [INFO] rustwide::tools: tool rustup is installed, trying to update
it
2019/12/08 13:09:53 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/rustup" "self" "update"`
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stderr] info: checking for self-updates
2019/12/08 13:09:53 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/rustup" "update" "stable"`
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stderr] info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout]   stable-x86_64-unknown-linux-gnu unchanged - rustc 1.39.0 (4560ea788 2019-11-04)
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stderr] info: checking for self-updates
2019/12/08 13:09:53 [INFO] rustwide::tools: tool cargo-install-update is installed, trying to update it
2019/12/08 13:09:53 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/cargo" "install-update" "cargo-update"`
2019/12/08 13:09:53 [INFO] rustwide::cmd: [stdout]     Updating registry 'https://github.com/rust-lang/crates.io-index'
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout] Package       Installed  Latest  Needs update
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout] cargo-update  v2.4.0     v2.4.0  No
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout] No packages need updating.
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout] Overall updated 0 packages.
2019/12/08 13:09:56 [INFO] rustwide::tools: tool rustup-toolchain-install-master is installed, trying to update it
2019/12/08 13:09:56 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/cargo" "install-update" "rustup-toolchain-install-master"`
2019/12/08 13:09:56 [INFO] rustwide::cmd: [stdout]     Updating registry 'https://github.com/rust-lang/crates.io-index'
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout] Package                          Installed  Latest  Needs update
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout] rustup-toolchain-install-master  v1.7.2     v1.7.2  No
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout] No packages need updating.
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout] Overall updated 0 packages.
2019/12/08 13:09:57 [INFO] rustwide::tools: tool git-credential-null is installed, trying to update it
2019/12/08 13:09:57 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/cargo" "install-update" "git-credential-null"`
2019/12/08 13:09:57 [INFO] rustwide::cmd: [stdout]     Updating registry 'https://github.com/rust-lang/crates.io-index'
2019/12/08 13:09:58 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:58 [INFO] rustwide::cmd: [stdout] Package              Installed  Latest  Needs update
2019/12/08 13:09:58 [INFO] rustwide::cmd: [stdout] git-credential-null  v1.0.1     v1.0.1  No
2019/12/08 13:09:58 [INFO] rustwide::cmd: [stdout]
2019/12/08 13:09:58 [INFO] rustwide::cmd: [stdout] No packages need updating.
2019/12/08 13:09:58 [INFO] rustwide::cmd: [stdout] Overall updated 0 packages.
2019/12/08 13:09:58 [INFO] cratesfyi::docbuilder::rustwide_builder: detecting rustc's version...
2019/12/08 13:09:58 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/rustc" "+nightly" "--version"`
thread 'main' panicked at 'failed to add essential files: ErrorMessage { msg: "command
`\"/opt/docsrs/rustwide/cargo-home/bin/rustc\" \"+nightly\" \"--version\"` failed" }',
src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

@jyn514
Copy link
Member

jyn514 commented Dec 8, 2019

@pickfire I'm not sure. Do you get the same error when you run it again? When you ran docker-compose run ... build the first time, did it get a chance to install nightly or did you cancel it first? Or is this your first time running that command?

@jyn514
Copy link
Member

jyn514 commented Dec 8, 2019

cc @pietroalbini , this is coming from https://github.com/rust-lang/docs.rs/blob/master/src/docbuilder/rustwide_builder.rs#L117 which doesn't show the output. I also wonder why rustwide returns a rustc that doesn't exist ... https://docs.rs/rustwide/0.3.2/src/rustwide/toolchain.rs.html#148-153

@pietroalbini
Copy link
Member

@pickfire that's probably a messed up rustwide installation. Try running:

docker-compose down --volumes
docker-compose up
docker-compose run web ...  # your command here

Note that the command will re-initialize rustwide, downloading everything (except the docker image) from scratch.

@pickfire
Copy link
Contributor Author

pickfire commented Dec 9, 2019

@jyn514 @pietroalbini Nope, same error, rustc nightly could not be found.

Maybe I just push the code first and let you all test it? I cannot build it from my end.

@jyn514
Copy link
Member

jyn514 commented Dec 9, 2019

@pietroalbini I'm not sure that down --volumes works for volumes that are mounted from a relative path.
@pickfire pushing the code would be helpful, but could you try rm -rf .rustwide-docker in the meantime?

@pickfire
Copy link
Contributor Author

@jyn514 Okay, I pushed to pickfire@fa76b93 (not tested). I also tried rm -rf .rustwide-docker and have to wait for the build in the meantime.

@jyn514
Copy link
Member

jyn514 commented Dec 10, 2019

This panics at startup: web_1 | thread 'main' panicked at 'Duplicate route_id: crate_name_version_source_'.

Let me know when you have rustwide working.

@pickfire
Copy link
Contributor Author

Now I get a different error.

...
2019/12/11 02:16:10 [INFO] rustwide::cmd: [stderr]     Finished release [optimized] target(s) in 11m 24s
2019/12/11 02:16:10 [INFO] rustwide::cmd: [stderr]   Installing /opt/docsrs/rustwide/cargo-home/bin/rustup-toolchain-install-master
2019/12/11 02:16:10 [INFO] rustwide::cmd: [stderr]    Installed package `rustup-toolchain-install-master v1.7.2` (executable `rustup-toolchain-install-master`)
2019/12/11 02:16:10 [INFO] rustwide::tools: tool git-credential-null is missing, installing it
2019/12/11 02:16:10 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/cargo" "+stable" "install" "git-credential-null"`
2019/12/11 02:16:10 [INFO] rustwide::cmd: [stderr]     Updating crates.io index
2019/12/11 02:16:14 [INFO] rustwide::cmd: [stderr]  Downloading crates ...
2019/12/11 02:16:17 [INFO] rustwide::cmd: [stderr]   Downloaded git-credential-null v1.0.1
2019/12/11 02:16:17 [INFO] rustwide::cmd: [stderr]   Installing git-credential-null v1.0.1
2019/12/11 02:16:17 [INFO] rustwide::cmd: [stderr]    Compiling git-credential-null v1.0.1
2019/12/11 02:16:18 [INFO] rustwide::cmd: [stderr]     Finished release [optimized] target(s) in 7.58s
2019/12/11 02:16:18 [INFO] rustwide::cmd: [stderr]   Installing /opt/docsrs/rustwide/cargo-home/bin/git-credential-null
2019/12/11 02:16:18 [INFO] rustwide::cmd: [stderr]    Installed package `git-credential-null v1.0.1` (executable `git-credential-null`)
2019/12/11 02:16:18 [INFO] cratesfyi::docbuilder::rustwide_builder: detecting rustc's version...
2019/12/11 02:16:18 [INFO] rustwide::cmd: running `"/opt/docsrs/rustwide/cargo-home/bin/rustc" "+nightly" "--version"`
thread 'main' panicked at 'failed to add essential files: ErrorMessage { msg: "command
`\"/opt/docsrs/rustwide/cargo-home/bin/rustc\" \"+nightly\" \"--version\"` failed" }',
src/libcore/result.rs:1165:5

@jyn514
Copy link
Member

jyn514 commented Dec 11, 2019

@pickfire could you join the Discord channel so we're not spamming this issue? docs-rs on https://discord.gg/rust-lang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants