git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org, Petr Baudis <pasky@ucw.cz>,
	Junio C Hamano <junkio@cox.net>
Subject: Re: [PATCH] git-tar-tree: add a test case (resent)
Date: Fri, 03 Jun 2005 13:25:18 +0200	[thread overview]
Message-ID: <42A03E1E.5060204@lsrfire.ath.cx> (raw)
In-Reply-To: <Pine.LNX.4.58.0506021830340.1876@ppc970.osdl.org>

Linus Torvalds schrieb:
> 
> 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();
 	}


  parent reply	other threads:[~2005-06-03 11:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-02 18:50 [PATCH] git-tar-tree: add a test case (resent) Rene Scharfe
2005-06-02 20:05 ` Junio C Hamano
2005-06-02 20:50   ` Rene Scharfe
2005-06-03  1:34 ` Linus Torvalds
2005-06-03  5:34   ` Rene Scharfe
2005-06-03 14:31     ` Linus Torvalds
2005-06-03 14:43       ` Rene Scharfe
2005-06-03 11:25   ` Rene Scharfe [this message]
2005-06-03 14:46     ` Linus Torvalds
2005-06-03 14:51       ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42A03E1E.5060204@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=pasky@ucw.cz \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).