gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] POSIX spec expert needed


From: Matthew Dempsky
Subject: Re: [Gnu-arch-users] POSIX spec expert needed
Date: Mon, 30 Aug 2004 17:27:34 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Andrew Suffield <address@hidden> writes:

> On Mon, Aug 30, 2004 at 02:14:02PM -0500, Matthew Dempsky wrote:
>> Can anyone confirm for me that when you make a call such as this:
>> 
>>           if (0 > vu_lseek (errn, file_fd, -1026, SEEK_END))
>> 
>> that it means there will be 1026 bytes left available to be read from
>> the file?
>
> *At least* 1026 bytes.

Right, but assuming the file isn't being modified at all through the
duration of this code, there will be 1026 bytes left (assuming the
file had at least 1026 to begin with).

>> Also, that after:
>> 
>>           amt = vu_read_retry (errn, file_fd, buf, sizeof (buf));
>> 
>> when buf is defined to 'char buf[1025]' that we will be missing the
>> last (possibly newline) byte of the file?
>
> No, see above. These operations aren't atomic; there might be more
> data. Just keep reading until you run out of file - treat the seek as
> an optimisation hint, rather than a part of the algorithm.

Again, see above -- no external operations.

And how do you figure vu_read_retry could keep reading until it hits
the end of the file if it's only called once and the buffer is fixed
at 1025 bytes?

My hypothesis is that the new bug some people are seeing when their
taglines are at the end of a file and now arch misses them might be
due to the fact that the last (newline) byte doesn't get read into the
buffer arch uses to scan for a tagline and so now it triggers the old
code that believes it has overrun a boundary because there's no
newline at the end of the tag.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]