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

linkchecker misreports target of broken link fragment #86144

Closed
jsha opened this issue Jun 8, 2021 · 1 comment · Fixed by #86156
Closed

linkchecker misreports target of broken link fragment #86144

jsha opened this issue Jun 8, 2021 · 1 comment · Fixed by #86156
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsha
Copy link
Contributor

jsha commented Jun 8, 2021

Steps to reproduce:

mkdir /tmp/links
cat <<EOF > /tmp/links/a.html
<div id="something">
  <a href="#something">
  <a href="b.html#something">
</div>
EOF
cat <<EOF > /tmp/links/b.html
<div id="else">
  <a href="#else">
</div>
EOF

./build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker /tmp/links/

Expected output:

a.html:3: broken link fragment #somethingpointing tob.html``

Actual output:

a.html:3: broken link fragment #somethingpointing toa.html``

(the difference: "pointing to a.html" vs "pointing to b.html")

This problem manifests specifically when a given file has an anchor with the same name as an anchor in a different file, and the anchor in the other file is missing.

I ran into this in practice #85970 and it sent me in a wrong debugging direction for a little while.

@jsha jsha added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 8, 2021
@ehuss
Copy link
Contributor

ehuss commented Jun 8, 2021

Ah, sorry about that, I'll post a quick fix.

@ehuss ehuss self-assigned this Jun 8, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jun 21, 2021
…ulacrum

Fix a bug in the linkchecker

There was a small typo in the linkchecker (in rust-lang#85652) that caused it to report a `#` fragment link error pointing to the wrong file (it was displaying the path to the source file, not the target of the link).

This also includes a few other changes:
- Fixes the tests due to some changes in the redirect handling in rust-lang#84703.
- Adds the tests to rustbuild to run whenever the linkchecker itself is run.
- Updates the tests to validate more of the output (so that a mistake like this would have been caught).

Closes rust-lang#86144
@bors bors closed this as completed in e435e32 Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants