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 15:22:27 -0700

On Mon, 2011-09-26 at 14:48 -0700, Sergey Poznyakoff wrote:
> Kevin Fox <address@hidden> ha escrit:
> 
> > Tar starts padding out the file
> > with 0's up until the file stat size and returns a message like:
> > NET.csv: File shrank by 45427965 bytes; padding with zeros
> 
> This means that a read returned 0 bytes,

Nope. Its clearly returning a short read, not a 0.

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.

>  but not all file contents has
> been read.  
> 
> > I believe in this case, tar should try to fill its remaining buffer
> > space with another read
> 
> That's what it actually does, but hits EOF.

I found the code in question and wrote a rough fix that works for me.
I'll submit a patch to the mailing list as soon as I can get it through
legal.

In the mean time, if you want to have a look:

search for safe_read in src/create.c. There is only one of them in that
file. It gets count, checks for error, then bails if count != bufsize,
never retrying in the short read case. I haven't looked farther to see
if there are any other code paths that have similar bugs.

Thanks,
Kevin

>   Are you sure it's not a bug
> of the underlying filesystem?
> 
> Regards,
> Sergey





reply via email to

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