"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Corruption in freshly checked out tree
To:
Tracey Emery <tracey@traceyemery.net>, Christian Weisgerber <naddy@mips.inka.de>, gameoftrees@openbsd.org
Date:
Tue, 11 Jan 2022 15:40:05 +0100

Download raw body.

Thread
On Tue, Jan 11, 2022 at 01:55:51AM +0100, Stefan Sperling wrote:
> I see the problem now, too. I see it like naddy and you on one machine,
> but on another machine the symptom looks very different:
> Only gc_9_0_default.h is corrupt (I missed this when I tried to reproduce
> the original report based on the other files), and not with perl code,
> but with text that looks like a weird version of itself.
> 
> Both machines are running the same snapshot I have built, and the same
> version of Got.
> 
> Anyway, yes, there is some issue here. No idea what is going on yet.

This fixes the problem for me. OK?

I would like to make a new release which includes this patch ASAP.

-----------------------------------------------
commit c88f83a51219da30ca665290595e3b6675e5965f (pack-fix)
from: Stefan Sperling <stsp@stsp.name>
date: Tue Jan 11 14:37:32 2022 UTC
 
 fix file corruption regression in 'got checkout' caused by commit db696021
 
 got-read-pack must rewind its files temporary files before reusing them.
 
diff aa3add5421626d252cdbd548a5e8500dcd1d0b7a 95f6350ca289447c225394582bae361c2cdd8e16
blob - 4a1a3b5a468f64d961a00092f1e31c7840fa0674
blob + d023ca662cadef23be987f2cb6408ceb599a0ebc
--- lib/pack.c
+++ lib/pack.c
@@ -1123,6 +1123,11 @@ got_pack_dump_delta_chain_to_file(size_t *result_size,
 			return got_error_from_errno("malloc");
 		base_file = NULL;
 		accum_file = NULL;
+	} else {
+		if (fseeko(base_file, 0L, SEEK_SET) == -1)
+			return got_error_from_errno("fseeko");
+		if (fseeko(accum_file, 0L, SEEK_SET) == -1)
+			return got_error_from_errno("fseeko");
 	}
 
 	/* Deltas are ordered in ascending order. */