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

[JGIT PATCH] Paper bag fix IndexPack thin pack completion support

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 30, 2008, 01:25 UTC
Message-ID
<20080630012538.GK11793@spearce.org>

We must write the whole object at the end of the file, not in the middle of the file on top of some delta (or other) whole object. Writing in the middle of the file causes subtle corruption as we cannot unpack a delta.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 This is a serious data corruption in IndexPack.  It was introduced
 by me in "Compute packed object entry CRC32 data during IndexPack",
 which is presently in `pu` as 4b8e1c0c.  It would be best if we
 squash this into the commit.
 .../src/org/spearce/jgit/transport/IndexPack.java  |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
index b35cec3..24a0577 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
@@ -407,10 +407,10 @@ public class IndexPack {
 			final PackedObjectInfo oe;
 
 			crc.reset();
+			packOut.seek(end);
 			writeWhole(def, typeCode, data);
 			oe = new PackedObjectInfo(end, (int) crc.getValue(), baseId);
 			entries[entryCount++] = oe;
-			packOut.seek(end);
 			end = packOut.getFilePointer();
 
 			resolveChildDeltas(oe.getOffset(), typeCode, data, oe);
-- 
1.5.6.74.g8a5e

-- 
Shawn.
Message 1 of 1 in “Paper bag fix IndexPack thin pack completion support”
  1. Paper bag fix IndexPack thin pack completion supportShawn O. Pearce, Jun 30, 2008

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.