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

Maintain broken symlink behaviour for the Windows exe resolver #91182

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

ChrisDenton
Copy link
Member

@ChrisDenton ChrisDenton commented Nov 24, 2021

When the resolver was updated to remove the current directory from the search path (see #87704), care was take to avoid unintentional changes that hadn't been discussed. However, I missed the broken symlink behaviour. This PR fixes that.

Edit This turned out to be more important than I first realised. There are some types of application stubs that will redirect to the actual process when run using CreateProcessW, but due to the way they're implemented they cannot be opened normally using a File::open that follows reparse points. So this doesn't work with our current exists and try_exists methods.

Fixes #91177

@rust-highfive
Copy link
Collaborator

r? @m-ou-se

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 24, 2021
@camelid camelid added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Nov 25, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 12, 2021
@bors
Copy link
Contributor

bors commented Dec 22, 2021

☔ The latest upstream changes (presumably #92201) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 30, 2022
@rust-log-analyzer

This comment has been minimized.

@ChrisDenton
Copy link
Member Author

@m-ou-se I've rebased and greatly simplified this PR. This turned out to be more important than I first realised so it'd be great if this could be merged reasonably quickly. Maybe even beta backported if that's an option.

There are some types of application stubs that will redirect to the actual process when run using CreateProcessW, but due to the way they're implemented they cannot be opened normally using a File::open that follows reparse points. So this breaks our current exists and try_exists methods.

@m-ou-se m-ou-se added the O-windows Operating system: Windows label Feb 16, 2022
@m-ou-se
Copy link
Member

m-ou-se commented Feb 16, 2022

Sorry for the delay.

@bors r+

Maybe even beta backported if that's an option.

It's a bit late for that, as beta is splitting off in a day or two.

Do you have an example of a situation that's broken and fixed by this PR? Did you or anyone else run into that issue?

@bors
Copy link
Contributor

bors commented Feb 16, 2022

📌 Commit 9a7a8b9 has been approved by m-ou-se

@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 Feb 16, 2022
@ChrisDenton
Copy link
Member Author

ChrisDenton commented Feb 16, 2022

Sorry for the delay.

No problem, I realise I was very last minute.

Do you have an example of a situation that's broken and fixed by this PR? Did you or anyone else run into that issue?

Yeah, this was an issue I ran into when testing something else. Basically when the Windows Store installs a command line application, it uses a special kind of proxy file. These applications cannot be found using Rust 1.58 (edit: they can be run using an absolute path though).

The reason is that the file has a "reparse tag" (i.e. link metadata) but the usual CreateFileW doesn't understand how to follow that link. CreateProcessW does however.

@ChrisDenton
Copy link
Member Author

I mean, nobody has reported an issue through all the time it spent in nightly, beta then stable. So it's not a common situation. It would be frustrating however if someone does encounter it because it may not be obvious what went wrong.

So I don't think this is absolutely urgent but I do think it's important enough to be rolled into a release whenever the next opportunity happens to be.

@Mark-Simulacrum
Copy link
Member

@bors p=1

@bors
Copy link
Contributor

bors commented Feb 16, 2022

⌛ Testing commit 9a7a8b9 with merge 2ff7ea4...

@bors
Copy link
Contributor

bors commented Feb 17, 2022

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 2ff7ea4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 17, 2022
@bors bors merged commit 2ff7ea4 into rust-lang:master Feb 17, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 17, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2ff7ea4): comparison url.

Summary: This benchmark run did not return any relevant results. 8 results were found to be statistically significant but too small to be relevant.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@ChrisDenton ChrisDenton deleted the command-broken-symlink branch March 10, 2022 03:25
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. O-windows Operating system: Windows S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The new Windows exe resolver has changed broken symlink behaviour