[KinoSearch] test failure in svn trunk t/core/051-fs_file_handle.t
Marvin Humphrey
marvin at rectangular.com
Fri Jan 15 22:43:15 PST 2010
On Fri, Jan 15, 2010 at 11:18:32PM -0600, Peter Karman wrote:
> The test label suggests that FSFH_Read() should be returning false, ostensibly
> before it gets to the memcpy() that causes the segfault.
That's right. The API for FileHandle's Read() is that it sets Err_error and
returns false when something goes wrong. Such as attempting to read from a
write-only handle.
> I looked at the other FSFH_Read() functions defined (this is calling the
> 64bit version) and they are all very different.
Yup. I screwed up the 64-bit version. (It was coded blind.) At least the
test caught it, though. :\ Thanks for troubleshooting.
> I am guessing the write-only flag is set by the underlying
> open() call on the filehandle and that KS isn't actually tracking that, since I
> see no check for it in the KS code.
We should check for the read-only flag up front in the 64-bit branch.
if (!(self->flags & FH_READ_ONLY)) {
/* ... */
}
For the 32-bit branches, we get to rely on a system call failing, but for
read-only 64-bit FSFileHandle objects we always mmap the whole file up front
-- so there's no system call to fail during Read().
Marvin Humphrey
More information about the kinosearch
mailing list