-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 for localized windows editions in testcase fn read_link() Issue#93211 #93283
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (or someone else) soon. Please see the contribution instructions for more information. |
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 for working on this!
You need to make sure that your PR does not contain any merge commits. Rebasing your branch on master should automatically remove the merge commit. See the Git documentation for details.
P.S. This is not an "official" review, I am just a contributor, not a team member.
@hkratz Thanks for the first tips. |
A force-push will update the PR. See also the relevant dev guide sections: |
This comment has been minimized.
This comment has been minimized.
Sorry I am stuck. I can not pull changes from the rust master (not my fork).
What I did before: where I updated the fix and pushed it back to my master with:
Which ended with: In MY git repo from the fork I now find the following:
However if I now execute: I get:
I am not sure how to resolve this, without making my branch just more of a mess. |
My rebase workflow looks like this: git switch issue-93211-fix # change to branch, if not already on it
git fetch upstream # get the most recent commits from the rust-lang repo rather than your own github fork, without updating any local branches
git rebase upstream/master # rebase on the remote master branch, not your local master, you can update the local master later
# fix conflicts here if necessary
git push --force # overwrite remote branch on your github fork with your local branch
To visualize current git state I have this in my
|
Okay, I followed your steps till here and everything went fine so far. Now I have to fix Thanks to Zulip everything should be alright now. |
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.
Those lines are also not part of your change.
@hkratz I think it should be correct now, hopefully, it went well this time. |
It seems unfortunate to have a CI gate on this test; I wonder if there's a better path that is not localized (for example) that we could use. @rustbot ping windows -- is there a better path for us to use here? Is there something we could check (better than a CI variable) to confirm that we're on an English-localized system perhaps? |
This comment was marked as resolved.
This comment was marked as resolved.
@rustbot ping windows |
Hey Windows Group! This bug has been identified as a good "Windows candidate". cc @arlosi @danielframpton @gdr-at-ms @kennykerr @luqmana @lzybkr @nico-abram @retep998 @rylev @sivadeilra @wesleywiser |
Thanks for the feedback so far! First, there is the one with the CI gate, which I actually liked, because I thought it would be the best compromise. Another solution would be to create the folder and instantly delete it after the test is over. An absolute overkill solution would be to make a map, which contains the "Documents and Settings" folder in every language, and then simply make a lookup. I also googled a bit to see if we could easily check in which language the initial windows installation was, but I did not find anything valuable. But yes, your idea regarding a non-localized path would be perfect! |
library/std/src/fs/tests.rs
Outdated
assert_eq!(check!(fs::read_link(r"C:\Documents and Settings\")), Path::new(r"C:\Users")); | ||
// Since not all localized windows versions contain the folder "Documents and settings" in english, | ||
// we will briefly check, if it exists and otherwise skip the test. Except during CI we will always execute the test. | ||
if Path::new(r"C:\Documents and settings\").exists() || env::var_os("CI").is_some() { |
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.
It looks like this might've lowercased Settings by accident? It should probably be "Settings" still. (Also in the assert).
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.
Yes, this is correct. It was an accident and should be in uppercase as well.
I'm inclined to move ahead with this PR (almost as-is, modulo the nit), and we can reconsider if it becomes a pain point in the future -- perhaps to just dropping the test altogether. |
Okay, so for now, you think it is not a big deal and therefore we shouldn't change this test currently? |
If you fix the nit, then I will go ahead and approve the PR; if for some reason it causes us problems we can reconsider at that point the best course of action. |
Okay just to clarify, because I am confused of the word "nit". I guess you mean when I fix the typo regarding the "Settings" correct? For sure, I try to fix that asap but I have to check if my laptop is able to handle, compiling the whole compiler, since I can't access my main pc for 1 month. I will try it out tomorrow! |
Feel free to just amend the commit; no need to test locally. If you could squash afterwards into one commit as well that would be good. |
Hey! |
I'm not aware of a better approach, unfortunately. |
@bors r+ rollup Thanks for your patience @m1guelperez, this looks great. I've approved it now and it will go into the merge queue before actually merging. |
📌 Commit b795ae5 has been approved by |
No problem! Glad to help and can't wait to make my next contribution! Thanks to the rust community for being always helpful especially as a beginner! See you. :-) |
Rollup of 5 pull requests Successful merges: - rust-lang#93283 (Fix for localized windows editions in testcase fn read_link() Issue#93211) - rust-lang#94592 (Fallback to top-level config.toml if not present in current directory, and remove fallback for env vars and CLI flags) - rust-lang#94776 (Optimize ascii::escape_default) - rust-lang#94840 (update `replace_bound_vars_with_placeholders` doc comment) - rust-lang#94842 (Remove unnecessary try_opt for operations that cannot fail) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR aims to fix the issue with localized windows versions that do not necessarily have the folder "Documents and settings" in English.
The idea was provided by @the8472. We check if the "CI" environment variable is set, then we always check for the "Documents and Settings"-folder, otherwise we check if the folder exists on the local machine, and if not we skip this assert.
Resoles #93211.