git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH] Paper bag fix IndexPack thin pack completion support
@ 2008-06-30  1:25 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2008-06-30  1:25 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

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.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-30  1:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-30  1:25 [JGIT PATCH] Paper bag fix IndexPack thin pack completion support Shawn O. Pearce

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).