ueno opened PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
tschneidereit requested kubkon for a review on PR #2070.
tschneidereit requested pchickey and kubkon for a review on PR #2070.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.
ueno edited PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
kubkon submitted PR Review.
kubkon submitted PR Review.
kubkon created PR Review Comment:
Would you mind extracting this out into a temp variable such as
let nread = ...
and then doing an assertionassert_eq!(nread, buffer.len(), ...)
? This hopefully should aid readability.
kubkon created PR Review Comment:
Would you mind tweaking the message here to "seeking to the beginning of the file again" or something like this? This should help in debugging especially in the CI should we introduce a regression at some point in the future.
kubkon created PR Review Comment:
In case
types::Filesize
ever changes its ABI fromu64
into something different, would you mind usingFrom
trait to do the cast here:read_total.into()
oru64::from(read_total)
?
kubkon created PR Review Comment:
Like above, if you could tweak this to use the
From
trait instead of using an explicitas
cast.
kubkon created PR Review Comment:
Is there any reason for this name change?
kubkon created PR Review Comment:
I think this should either be
EFAULT
orENOMEM
. The former seems to be accurate for Linux, while the latter for macOS (and probably BSDs in general). But to get another pair of eyes on this, @sunfishcode could you offer some advice here please?
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno submitted PR Review.
ueno created PR Review Comment:
This is just for consistency; in other tests such as
fd_flags_set.rs
orfile_truncate.rs
, "buffer" (or "buf") is used as a name of mutable buffers, and immutable buffers are called "data" or "contents". As we callfd_read
below and need to assign a name to the immutable buffer, I thought it might be less confusing to follow the convention.
kubkon submitted PR Review.
kubkon created PR Review Comment:
Huh, I didn't know we had a convention for this, but this makes sense! I'll make sure that we keep it that way from now on. Thanks!
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno submitted PR Review.
ueno created PR Review Comment:
Since there is no auto conversion from
usize
tou64
, I added a temporary variable with type annotation and usedtry_into
, but I suppose there is a simpler solution.Btw, while doing that I also noticed
fd_pwrite
has the same issue, so I included a fix for that as well.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
kubkon submitted PR Review.
kubkon created PR Review Comment:
@ueno could you replace this
as
cast withTryInto
as well here?
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
kubkon submitted PR Review.
kubkon created PR Review Comment:
Would you mind linking in rust-lang/rust#74825 for posterity?
kubkon submitted PR Review.
kubkon created PR Review Comment:
And here?
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
sunfishcode submitted PR Review.
sunfishcode created PR Review Comment:
Looking at POSIX, this looks like more of an
EINVAL
situation thanEFAULT
.https://pubs.opengroup.org/onlinepubs/009695399/functions/pread.html
EINVAL
is for "the offset argument is not valid".
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno submitted PR Review.
ueno created PR Review Comment:
Thank you for the pointer; I've updated it to using
EINVAL
.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
kubkon submitted PR Review.
ueno updated PR #2070 from wip/dueno/fd-read-virtfs
to main
:
If a handle is backed by
InMemoryFile
,fd_read
(turned intoHandle::read_vectored
) doesn't update the cursor position properly and thus prevents the caller from detecting EOF.This also fixes a similar issue in
fd_pread
, which doesn't advance the read offset when reading data into multiple iovecs.
kubkon merged PR #2070.
Last updated: Nov 22 2024 at 17:03 UTC