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

Fix ICE when there is a non-Unicode entry in the incremental crate directory #124112

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

beetrees
Copy link
Contributor

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of to_string_lossy + assert_no_characters_lost with to_str. The added test would cause the compiler to ICE before this PR.

@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 18, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2024

Some changes occurred in run-make tests.

cc @jieyouxu

@Nadrieril
Copy link
Member

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 18, 2024

📌 Commit ed8f351 has been approved by Nadrieril

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 18, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 18, 2024
…rieril

Fix ICE when there is a non-Unicode entry in the incremental crate directory

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of `to_string_lossy` + `assert_no_characters_lost` with `to_str`. The added test would cause the compiler to ICE before this PR.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 18, 2024
…rieril

Fix ICE when there is a non-Unicode entry in the incremental crate directory

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of `to_string_lossy` + `assert_no_characters_lost` with `to_str`. The added test would cause the compiler to ICE before this PR.
@workingjubilee
Copy link
Member

I believe this is failing rollups:

#124133 (comment)

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 18, 2024
@workingjubilee
Copy link
Member

I tested my hypothesis and was wrong.

@bors r=Nadrieril

@bors
Copy link
Contributor

bors commented Apr 18, 2024

📌 Commit ed8f351 has been approved by Nadrieril

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 18, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Apr 18, 2024
…rieril

Fix ICE when there is a non-Unicode entry in the incremental crate directory

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of `to_string_lossy` + `assert_no_characters_lost` with `to_str`. The added test would cause the compiler to ICE before this PR.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
…kingjubilee

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117919 (Introduce perma-unstable `wasm-c-abi` flag)
 - rust-lang#123406 (Force exhaustion in iter::ArrayChunks::into_remainder)
 - rust-lang#123752 (Properly handle emojis as literal prefix in macros)
 - rust-lang#123935 (Don't inline integer literals when they overflow - new attempt)
 - rust-lang#123980 ( Add an opt-in to store incoming edges in `VecGraph` + misc)
 - rust-lang#124019 (Use raw-dylib for Windows synchronization functions)
 - rust-lang#124110 (Fix negating `f16` and `f128` constants)
 - rust-lang#124112 (Fix ICE when there is a non-Unicode entry in the incremental crate directory)
 - rust-lang#124116 (when suggesting RUST_BACKTRACE=1, add a special note for Miri's env var isolation)

r? `@ghost`
`@rustbot` modify labels: rollup
@beetrees
Copy link
Contributor Author

I've fixed the test failure that was caused by some filesystems not supporting non-Unicode paths.

@rustbot
Copy link
Collaborator

rustbot commented Apr 19, 2024

The run-make-support library was changed

cc @jieyouxu

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

#[cfg(windows)]
let non_unicode: std::ffi::OsString = std::os::windows::ffi::OsStringExt::from_wide(&[0xD800]);
match std::fs::create_dir(tmp_dir().join(&non_unicode)) {
Err(e) if e.raw_os_error() == Some(libc::EILSEQ) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That error code assumes create_dir is implemented using a POSIX API. That isn't true on Windows and may not even be true on Unix OSes (depending on how the create_dir is implemented).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see EILSEQ referenced anywhere in std so I don't think there's a portable way to detect this. You can always try to create a file with a unicode path first to ensure the test doesn't silently fail for other permissions reasons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we fail here, then surely we also fail in incremental when trying to create a directory with non-Unicode characters? Would that also ICE?

Do we even want to support non-Unicode incremental directory paths, given it is not at all portable (seeing that there doesn't seem to be an easy way to even test this behavior portably)? Would it make more sense to convert the ICE to a fatal error?

Copy link
Contributor Author

@beetrees beetrees Apr 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incremental will never create a directory with a non-Unicode name - session directory names have a specific format and are always valid Unicode. The ICE would occur (before this PR) if something else had created a file/directory with a non-Unicode name in the incremental crate directory. When find_source_directory iterates over the incremental crate directory to find the most recent published session directory, it ignores any entries that do not have names in the expected format (checked with is_session_directory() etc.). However, before this PR, instead of ignoring entry names with non-Unicode characters in them (as session directories always have valid Unicode names) the compiler would instead ICE in the assert_no_characters_lost() function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone with something similar to @Nadrieril's suggestion and checked if creating a directory with a valid Unicode name would succeed if creating a directory with a non-Unicode name failed.

@Nadrieril
Copy link
Member

@bors r-

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 19, 2024
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 19, 2024
@beetrees beetrees requested a review from Nadrieril April 21, 2024 10:29
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 21, 2024
@Nadrieril
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Apr 21, 2024

📌 Commit 71f751d has been approved by Nadrieril

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2024
@Nadrieril Nadrieril removed their request for review April 21, 2024 12:27
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2024
…eril

Fix ICE when there is a non-Unicode entry in the incremental crate directory

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of `to_string_lossy` + `assert_no_characters_lost` with `to_str`. The added test would cause the compiler to ICE before this PR.
@bors
Copy link
Contributor

bors commented Apr 21, 2024

⌛ Testing commit 71f751d with merge a55d3d7...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-aux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Apr 21, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 21, 2024
@Nadrieril
Copy link
Member

Looks unrelated

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2024
@bors
Copy link
Contributor

bors commented Apr 22, 2024

⌛ Testing commit 71f751d with merge 3288583...

@bors
Copy link
Contributor

bors commented Apr 22, 2024

☀️ Test successful - checks-actions
Approved by: Nadrieril
Pushing 3288583 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 22, 2024
@bors bors merged commit 3288583 into rust-lang:master Apr 22, 2024
13 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 22, 2024
@beetrees beetrees deleted the incremental-os-str branch April 22, 2024 06:23
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3288583): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.1% [4.1%, 4.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.1% [4.1%, 4.1%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 672.434s -> 671.523s (-0.14%)
Artifact size: 315.47 MiB -> 315.42 MiB (-0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants