diff options
author | Dean Deng <deandeng@google.com> | 2020-08-27 16:52:21 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-27 16:57:40 -0700 |
commit | 84f04909c2c3a55b209f01315493e6850160d707 (patch) | |
tree | 38da40c809f0ec170f3b97f362fcbe4215e2801b /test/image/image.go | |
parent | dc008fbbccf69deba55fd7649424bc568f766596 (diff) |
Fix vfs2 pipe behavior when splicing to a non-pipe.
Fixes *.sh Java runtime tests, where splice()-ing from a pipe to /dev/zero
would not actually empty the pipe.
There was no guarantee that the data would actually be consumed on a splice
operation unless the output file's implementation of Write/PWrite actually
called VFSPipeFD.CopyIn. Now, whatever bytes are "written" are consumed
regardless of whether CopyIn is called or not.
Furthermore, the number of bytes in the IOSequence for reads is now capped at
the amount of data actually available. Before, splicing to /dev/zero would
always return the requested splice size without taking the actual available
data into account.
This change also refactors the case where an input file is spliced into an
output pipe so that it follows a similar pattern, which is arguably cleaner
anyway.
Updates #3576.
PiperOrigin-RevId: 328843954
Diffstat (limited to 'test/image/image.go')
0 files changed, 0 insertions, 0 deletions