Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-io |
Member
|
There is already a PR up for it #132396. |
Contributor
Author
|
Thanks for pointing this out. I wasn't aware that #132396 was already addressing the same issue. I'll close this PR to avoid duplicating the existing work. Thanks for the clarification! |
This was referenced Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #119216
Customer Impact
In containerized or minimal Linux environments (such as Docker containers or NixOS builds where
/etc/passwdis absent), callingSystem.Environment.UserName,System.Formats.Tar, orSystem.IO.Pipesthrows an unhandledSystem.IO.IOException: No such file or directory, causing tools like MSBuild and user applications to crash.According to the POSIX specification for
getpwuid_r, missing user records or a missing user database can returnENOENT("No such file or directory") orESRCH("No such process/user"). Furthermore, the XML doc forGetUserNameFromPasswdexplicitly states:Description of Changes
Interop.GetPwUid.cs, updatedTryGetUserNameFromPasswdto treaterrorInfo.Error == Interop.Error.ENOENTanderrorInfo.Error == Interop.Error.ESRCHas entry-not-found (username = null; return true;), allowingGetUserNameFromPasswdto returnstring.Emptyas documented.TarWriter.WriteEntry.File.Tests.Unix.cstestingGetUserNameFromPasswdwith a non-existent UID (uint.MaxValue), asserting that it returnsstring.Emptywithout throwing.UserName_Unix_DoesNotThrowinEnvironment.UserName.cs.Regression
No.
Testing
System.Private.CoreLibbuilt cleanly with 0 warnings, 0 errors.System.Formats.Tar(including Unix build target) built cleanly with 0 warnings, 0 errors.Risk
Low. Directly fulfills the documented contract of
GetUserNameFromPasswdand prevents process crashes in containerized environments.