Skip to content

Base.subproject: correct home directory handling on Windows #4692

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

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

compnerd
Copy link
Member

While we can enumerate the users using NetUserEnum, that does not guarantee that we get the full user information. Perform an explicit NetUserGetInfo to query the user information to get the home directory.

Additionally, correct the CFString handling within the function where we were improperly using CFStringCreateWithBytesNoCopy which requires that the string is 8-bit encoded. We now use
CFStringCreateWithCharacters[NoCopy] to properly create the CFString with unicode characters.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

CC: @parkera @lorentey

Prefer to use `NetUserGetInfo` over enumerating all users as that is
unnecessary.  Correct the string handling where we used
`CFStringCreateWithBytesNoCopy` which expects the input to be in an
8-bit encoding which we do not use (nor does Windows support for the SAM
access).  This corrects the string manipulation which improves the test
suite pass rate though some errors still remain.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Linux platform

@compnerd compnerd merged commit 0236364 into swiftlang:main Jan 20, 2023
@compnerd compnerd deleted the home-sweet-home branch January 20, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants