-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix some bootstrap papercuts #139823
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
Fix some bootstrap papercuts #139823
Conversation
Some changes occurred in src/tools/compiletest cc @jieyouxu This PR modifies If appropriate, please update |
This comment has been minimized.
This comment has been minimized.
// NOTE: This check is required because `jj git clone` doesn't create directories for | ||
// submodules, they are completely ignored. The code below assumes this directory exists, | ||
// so create it here. | ||
if !absolute_path.exists() { | ||
t!(fs::create_dir_all(&absolute_path)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: Path::exists
will traverse symlinks to look for existence of the destination file (i.e. not necessarily the "shallow" $checkout_root/$usual_submodule_location
), but I guess if the user has a symlink in the place of the usual submodules in checkout...
src/tools/compiletest/src/runtest.rs
Outdated
// Canonicalize test build directory path. | ||
// Without this some tests fail if build directory is a symlink. | ||
let output_base_dir = fs::canonicalize(self.output_base_dir()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I just switched compiletest over to use camino
to enforce UTF-8 paths, so this should instead be
let output_base_dir = self.output_base_dir().canonicalize_utf8().unwrap();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion: that being said, I'm not 100% sure this is sufficient in itself, since rustc itself might have inconsistencies when build/
is a symlink to elsewhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(note that there are more fs::canonicalize
in the file, not sure if they are intended)
The tests seem to pass for me, so this is probably fine. I'm more concerned about a case where the directory doesn't exist, or, windows where canonicalize might return weird paths:
On Windows, this converts the path to use extended length path syntax, which allows your program to use longer path names, but means you can only join backslash-delimited paths to it, and it may be incompatible with other applications (if passed to the application on the command-line, or written to a file another application may read).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, some of these runtest bits need further auditing, which is beyond the scope of this PR.
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
Fix fixes failures of the following tests when build directory is a symlink: - `tests/ui/error-codes/E{0464,0523}.rs` - `tests/ui/crate-loading/crateresolve{1,2}.rs` (those are the same tests)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@bors r+ rollup |
I ran more tests and some are broken (potentially as a result of this PR), so @bors r- |
Apparently there are tests that print canonical paths *and* tests which print non-canonical paths. An example of the latter is `tests/ui/type_length_limit.rs`.
@rustbot review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh... I guess I'm not really surprised that this isn't super consistent, lol. Thanks
@bors r+ rollup |
Fix some bootstrap papercuts ... related to jj and my `./build` symlink setup[^1]. I'm not sure if these are good solutions, but they seem to work. See commits for a bit more info. r? `@jieyouxu` [^1]: see rust-lang#139804
Rollup of 10 pull requests Successful merges: - rust-lang#139647 (Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options) - rust-lang#139823 (Fix some bootstrap papercuts) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139867 (Fix some tidy paper cuts) - rust-lang#139871 (Fix wrong "move keyword" suggestion for async gen block) - rust-lang#139876 (Make CodeStats' type_sizes public) - rust-lang#139880 (Don't compute name of associated item if it's an RPITIT) - rust-lang#139884 (Update books) - rust-lang#139886 (`borrowck_graphviz_*` attribute tweaks) - rust-lang#139893 (Add test for issue 125668) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#139647 (Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options) - rust-lang#139823 (Fix some bootstrap papercuts) - rust-lang#139867 (Fix some tidy paper cuts) - rust-lang#139871 (Fix wrong "move keyword" suggestion for async gen block) - rust-lang#139876 (Make CodeStats' type_sizes public) - rust-lang#139880 (Don't compute name of associated item if it's an RPITIT) - rust-lang#139884 (Update books) - rust-lang#139886 (`borrowck_graphviz_*` attribute tweaks) - rust-lang#139893 (Add test for issue 125668) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#139647 (Add unstable parsing of `--extern foo::bar=libbar.rlib` command line options) - rust-lang#139823 (Fix some bootstrap papercuts) - rust-lang#139867 (Fix some tidy paper cuts) - rust-lang#139871 (Fix wrong "move keyword" suggestion for async gen block) - rust-lang#139876 (Make CodeStats' type_sizes public) - rust-lang#139880 (Don't compute name of associated item if it's an RPITIT) - rust-lang#139884 (Update books) - rust-lang#139886 (`borrowck_graphviz_*` attribute tweaks) - rust-lang#139893 (Add test for issue 125668) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139823 - WaffleLapkin:bootpaper, r=jieyouxu Fix some bootstrap papercuts ... related to jj and my `./build` symlink setup[^1]. I'm not sure if these are good solutions, but they seem to work. See commits for a bit more info. r? ``@jieyouxu`` [^1]: see rust-lang#139804
Don't canonicalize crate paths When printing paths in diagnostic we should favour printing the paths that were passed in rather than resolving all symlinks. This PR changes the form of the crate path but it should only really affect diagnostics as filesystem functions won't care which path is used. The uncanonicalized path was already used as a fallback for when canonicalization failed. This is a partial alternative to rust-lang#139823.
Don't canonicalize crate paths When printing paths in diagnostic we should favour printing the paths that were passed in rather than resolving all symlinks. This PR changes the form of the crate path but it should only really affect diagnostics as filesystem functions won't care which path is used. The uncanonicalized path was already used as a fallback for when canonicalization failed. This is a partial alternative to rust-lang#139823.
Don't canonicalize crate paths When printing paths in diagnostic we should favour printing the paths that were passed in rather than resolving all symlinks. This PR changes the form of the crate path but it should only really affect diagnostics as filesystem functions won't care which path is used. The uncanonicalized path was already used as a fallback for when canonicalization failed. This is a partial alternative to rust-lang#139823.
Rollup merge of rust-lang#139834 - ChrisDenton:spf, r=WaffleLapkin Don't canonicalize crate paths When printing paths in diagnostic we should favour printing the paths that were passed in rather than resolving all symlinks. This PR changes the form of the crate path but it should only really affect diagnostics as filesystem functions won't care which path is used. The uncanonicalized path was already used as a fallback for when canonicalization failed. This is a partial alternative to rust-lang#139823.
... related to jj and my
./build
symlink setup1.I'm not sure if these are good solutions, but they seem to work. See commits for a bit more info.
r? @jieyouxu
Footnotes
see use
realpath
inbootstrap.py
when creating build-dir #139804 ↩