-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Relax RandomAccess type requirements: make Read/Write methods work with non-seekable files #125512
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
base: main
Are you sure you want to change the base?
Changes from all commits
b1a3fd8
5d43e89
ea20ad6
62659a4
098316d
a5d8cb2
8982b12
1d5307c
1dd370b
38df64c
d0709ef
a674e0f
19d57c8
d7322ee
da4579d
272996b
3b45b71
ddab128
c6926fc
7c37673
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Runtime.InteropServices; | ||
|
|
||
| internal static partial class Interop | ||
| { | ||
| internal static partial class Sys | ||
| { | ||
| [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadV", SetLastError = true)] | ||
| internal static unsafe partial long ReadV(SafeHandle fd, IOVector* vectors, int vectorCount); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Runtime.InteropServices; | ||
|
|
||
| internal static partial class Interop | ||
| { | ||
| internal static partial class Sys | ||
| { | ||
| [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_WriteV", SetLastError = true)] | ||
| internal static unsafe partial long WriteV(SafeHandle fd, IOVector* vectors, int vectorCount); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -350,7 +350,7 @@ public void WaitForPeerProcess() | |||||||||||||||||||||||||
| child2.StartInfo.RedirectStandardOutput = true; | ||||||||||||||||||||||||||
| child2.Start(); | ||||||||||||||||||||||||||
| char[] output = new char[6]; | ||||||||||||||||||||||||||
| child2.StandardOutput.Read(output, 0, output.Length); | ||||||||||||||||||||||||||
| child2.StandardOutput.ReadBlock(output, 0, output.Length); | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To other reviewers: this change was needed because we emulate partial writes in runtime/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs Lines 156 to 167 in 755fa8f
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't this WaitForPeerProcess always wrong, and we were just getting lucky because of implementation detail? i.e. regardless of that debug condition, there's no guarantee Read would always return as much as was requested
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, more or less we were always lucky so far. I wanted to be clear why it was not needed before (to show it's not a bug now) |
||||||||||||||||||||||||||
| Assert.Equal("Signal", new string(output)); // wait for the signal before killing the peer | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| child1.Kill(); | ||||||||||||||||||||||||||
|
|
@@ -380,7 +380,7 @@ public async Task WaitAsyncForPeerProcess() | |||||||||||||||||||||||||
| child2.StartInfo.RedirectStandardOutput = true; | ||||||||||||||||||||||||||
| child2.Start(); | ||||||||||||||||||||||||||
| char[] output = new char[6]; | ||||||||||||||||||||||||||
| child2.StandardOutput.Read(output, 0, output.Length); | ||||||||||||||||||||||||||
| child2.StandardOutput.ReadBlock(output, 0, output.Length); | ||||||||||||||||||||||||||
| Assert.Equal("Signal", new string(output)); // wait for the signal before killing the peer | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| child1.Kill(); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.