Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Update Unix SafeHandle to throw NotFound correctly #11757

Merged
merged 2 commits into from
May 22, 2017

Conversation

JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented May 19, 2017

Need to match Windows semantics for missing files. This means throwing
FileNotFound only if the last segment of the path can't be found.

Related to dotnet/corefx#19959 and https://github.com/dotnet/corefx/issues/19850.

Need to match Windows semantics for missing files. This means throwing
FileNotFound only if the last segment of the path can't be found.
@JeremyKuhne JeremyKuhne added this to the 2.0.0 milestone May 20, 2017
@JeremyKuhne
Copy link
Member Author

Validated fully. System.IO.FileSystem.Tests needs File_Copy_str_str.NonExistentPath()'s OS condition removed to take this change into CoreFX.

if (handle.IsInvalid)
{
Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we'd dispose of the handle, even though it's invalid, to avoid it needing to be finalized.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks- totally overlooked that.

@JeremyKuhne
Copy link
Member Author

Disposed the handle and ported dotnet/corefx#20049

@JeremyKuhne
Copy link
Member Author

@stephentoub Can you take a look at the update?

@JeremyKuhne JeremyKuhne merged commit a2329cb into dotnet:master May 22, 2017
@JeremyKuhne JeremyKuhne deleted the fsnotfound branch May 22, 2017 19:49
dotnet-bot pushed a commit to dotnet/corert that referenced this pull request May 22, 2017
)

* Update Unix SafeHandle to throw NotFound correctly

Need to match Windows semantics for missing files. This means throwing
FileNotFound only if the last segment of the path can't be found.

* Dispose handle and trim ending separator properly

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corert that referenced this pull request May 22, 2017
)

* Update Unix SafeHandle to throw NotFound correctly

Need to match Windows semantics for missing files. This means throwing
FileNotFound only if the last segment of the path can't be found.

* Dispose handle and trim ending separator properly

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
JeremyKuhne added a commit to JeremyKuhne/coreclr that referenced this pull request May 22, 2017
* Update Unix SafeHandle to throw NotFound correctly

Need to match Windows semantics for missing files. This means throwing
FileNotFound only if the last segment of the path can't be found.

* Dispose handle and trim ending separator properly
JeremyKuhne added a commit that referenced this pull request May 23, 2017
* Update Unix SafeHandle to throw NotFound correctly

Need to match Windows semantics for missing files. This means throwing
FileNotFound only if the last segment of the path can't be found.

* Dispose handle and trim ending separator properly
@karelz karelz modified the milestones: 2.1.0, 2.0.0 Aug 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants