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 Path.GetPathRoot wrong check in Unix #35734

Merged
merged 4 commits into from
May 13, 2020

Conversation

carlossanlop
Copy link
Member

Fixes #35260

The first element in the condition of the conditional operator was wrong: We should return null if the passed path is effectively empty. I made sure the structure looked just like in the other method overload, to avoid confusion.

I added one unit test to verify the particular case in which I found the bug. In my PR for redundant segments I will be adding many more since GetPathRoot is used by the new API.

@ghost
Copy link

ghost commented May 2, 2020

Tagging subscribers to this area: @jozkee
Notify danmosemsft if you want to be subscribed.

@carlossanlop carlossanlop requested a review from jozkee May 2, 2020 00:49
@carlossanlop carlossanlop requested a review from jkotas May 2, 2020 00:49
Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

The product fix looks good. I agree with Jan about fixing the test.

@carlossanlop carlossanlop merged commit 61c6581 into dotnet:master May 13, 2020
@carlossanlop carlossanlop deleted the FixGetPathRoot branch May 13, 2020 19:24
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different output in Unix between Path.GetPathRoot overloads for redundant segments
4 participants