Re: [PATCH] git-tar-tree: add a test case (resent)
- From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
- Date
- Jun 3, 2005, 11:25 UTC
- Message-ID
- <42A03E1E.5060204@lsrfire.ath.cx>
- In-Reply-To
- <Pine.LNX.4.58.0506021830340.1876@ppc970.osdl.org>
Linus Torvalds schrieb:
Show 13 quoted lines
> > On Thu, 2 Jun 2005, Rene Scharfe wrote: > >>git-tar-tree: add a simple test case. > > > I get: > > * FAIL 6: extract tar archive (cd b && tar xf -) <b.tar > * FAIL 7: validate filenames (cd b/a && find .) | sort >b.lst && > * FAIL 8: validate file contents diff -r a b/a > * FAIL 11: validate filenames with prefix (cd c/prefix/a && find .) | sort >c.lst && > * FAIL 12: validate file contents with prefix diff -r a c/prefix/a
Meine Fresse, what a stoopid bug. Fortunately I introduced it with one of the other two patches sent together with the test case patch, namely "[PATCH] git-tar-tree: cleanup write_trailer() (resent)". Of course I only wanted to demonstrate how useful those tests really are. ;-)
Btw., I got it right the first time and messed up when resending..
write_trailer() writes the last 10k (a full block) of the tar archive. write_if_needed() writes out a block *if* it is full and then sets the offset to 0. In nine out of ten cases the messed up write_trailer() function didn't manage to fill the block thus not writing anything at all, truncating the archive. I was "lucky" to hit the other case and so my testing ran OK.
Here's a patch.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
--- a/tar-tree.c +++ b/tar-tree.c @@ -77,7 +77,7 @@ write_if_needed(); get_record(); write_if_needed(); - if (offset) { + while (offset) { get_record(); write_if_needed(); }