bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Tar short read


From: Kevin Fox
Subject: Re: [Bug-tar] Tar short read
Date: Mon, 26 Sep 2011 17:40:05 -0700

On Mon, 2011-09-26 at 15:33 -0700, Paul Eggert wrote:
> On 09/26/11 15:22, Kevin Fox wrote:
> > I see a read of 8704 (10240 - the tar headers I'm assuming)
> > then 3275 reads of 10240 bytes each,
> > then the short read of 9728 (sums to exactly 32mb) then tar never issues
> > another read on that descriptor.
> 
> POSIX says that short reads are allowed only near end-of-file,
> or when signals arrive, or for pipes, FIFOs, and special files.
> They are not allowed while reading in the middle of a regular file,
> and if your file system exhibits short reads in that situation
> it will likely break lots of programs.  I suggest fixing the
> file system rather than putting workarounds into GNU tar and lots of
> other programs.

I've been using cp successfully for a while but after reading this,
explored it a bit more.

I modified the hello world fuse example to turn on direct_io and partial
return all reads one byte at a time for testing.

cp must not have broken before because I was using a block size which
was a multiple of cp's block size.

cp breaks much worse then tar under this situation. The first read, it
reads one byte. Then next read it doesn't even increment offset, just
tries again. It reads the same one byte, then assumes all is well,
finishes the copy and returns 0 silently succeeding. :/

So, I guess I'll be fixing it in the file system.

But, an hypothetical question, if I simply sent out a signal in the file
system while issuing the partial read should be enough to make it posix
behavior again. Shouldn't tar and cp support partial, interrupted reads
anyway? Isn't that the same code?

Thanks,
Kevin

> 
> Here's the POSIX citation:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html





reply via email to

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