git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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();
 	}
Previous: Rene ScharfeNext: Linus Torvalds
Message 8 of 10 in “git-tar-tree: add a test case (resent)”
  1. git-tar-tree: add a test case (resent)Rene Scharfe, Jun 2, 2005
  2. Junio C HamanoJun 2, 2005
  3. Rene ScharfeJun 2, 2005
  4. Linus TorvaldsJun 3, 2005
  5. Rene ScharfeJun 3, 2005
  6. Linus TorvaldsJun 3, 2005
  7. Rene ScharfeJun 3, 2005
  8. Rene ScharfeJun 3, 2005
  9. Linus TorvaldsJun 3, 2005
  10. Linus TorvaldsJun 3, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.