-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: fix panic on directory symlinks #93897
Conversation
In Debian and Ubuntu, there are some patches that change the rustc/fonts directory to a symlink to the system fonts. This triggers a latent bug in linkchecker, as the DirEntry filetype isn't a dir but later on the file itself, when opened, is one, triggering an unreachable!() clause. This patch fixes the situation by using std::fs::metadata, which goes through symlinks. I'd have added a test case but `tidy` doesn't seem to like symlinks, and moreover I'm not sure how Git deals with symlinks on Windows. Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
You could generate the testcase at test-time in a temporary directory. And bail out if symlinks aren't supported. |
I'm not convinced a test case is necessary, particularly when we ourselves don't really use this functionality. linkcheck isn't a stability deliverable. @bors r+ rollup |
📌 Commit 3a1ffea has been approved by |
…Mark-Simulacrum linkchecker: fix panic on directory symlinks In Debian and Ubuntu, there are some patches that change the rustc/fonts directory to a symlink to the system fonts. This triggers a latent bug in linkchecker, as the DirEntry filetype isn't a dir but later on the file itself, when opened, is one, triggering an unreachable!() clause. This patch fixes the situation by using std::fs::metadata, which goes through symlinks. I'd have added a test case but `tidy` doesn't seem to like symlinks, and moreover I'm not sure how Git deals with symlinks on Windows. Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
…Mark-Simulacrum linkchecker: fix panic on directory symlinks In Debian and Ubuntu, there are some patches that change the rustc/fonts directory to a symlink to the system fonts. This triggers a latent bug in linkchecker, as the DirEntry filetype isn't a dir but later on the file itself, when opened, is one, triggering an unreachable!() clause. This patch fixes the situation by using std::fs::metadata, which goes through symlinks. I'd have added a test case but `tidy` doesn't seem to like symlinks, and moreover I'm not sure how Git deals with symlinks on Windows. Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#91908 (Add 2 tests) - rust-lang#93595 (fix ICE when parsing lifetime as function argument) - rust-lang#93757 (Add some known GAT bugs as tests) - rust-lang#93759 (Pretty print ItemKind::Use in rustfmt style) - rust-lang#93897 (linkchecker: fix panic on directory symlinks) - rust-lang#93898 (tidy: Extend error code check) - rust-lang#93928 (Add missing release notes for rust-lang#85200) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
In Debian and Ubuntu, there are some patches that change the rustc/fonts
directory to a symlink to the system fonts. This triggers a latent bug
in linkchecker, as the DirEntry filetype isn't a dir but later on the
file itself, when opened, is one, triggering an unreachable!() clause.
This patch fixes the situation by using std::fs::metadata, which goes
through symlinks.
I'd have added a test case but
tidy
doesn't seem to like symlinks, andmoreover I'm not sure how Git deals with symlinks on Windows.
Signed-off-by: Simon Chopin simon.chopin@canonical.com