{"thread":{"id":"14215","subject":"[JGIT PATCH] Paper bag fix IndexPack thin pack completion support","startedAt":"2008-06-30T01:25:38Z","lastAt":"2008-06-30T01:25:38Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"81694","messageId":"20080630012538.GK11793@spearce.org","threadId":"14215","inReplyTo":null,"subject":"[JGIT PATCH] Paper bag fix IndexPack thin pack completion support","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-06-30T01:25:38Z","receivedAt":"2008-06-30T01:25:38Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"We must write the whole object at the end of the file, not in the\nmiddle of the file on top of some delta (or other) whole object.\nWriting in the middle of the file causes subtle corruption as we\ncannot unpack a delta.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n This is a serious data corruption in IndexPack.  It was introduced\n by me in \"Compute packed object entry CRC32 data during IndexPack\",\n which is presently in `pu` as 4b8e1c0c.  It would be best if we\n squash this into the commit.\n\n .../src/org/spearce/jgit/transport/IndexPack.java  |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java\nindex b35cec3..24a0577 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java\n@@ -407,10 +407,10 @@ public class IndexPack {\n \t\t\tfinal PackedObjectInfo oe;\n \n \t\t\tcrc.reset();\n+\t\t\tpackOut.seek(end);\n \t\t\twriteWhole(def, typeCode, data);\n \t\t\toe = new PackedObjectInfo(end, (int) crc.getValue(), baseId);\n \t\t\tentries[entryCount++] = oe;\n-\t\t\tpackOut.seek(end);\n \t\t\tend = packOut.getFilePointer();\n \n \t\t\tresolveChildDeltas(oe.getOffset(), typeCode, data, oe);\n-- \n1.5.6.74.g8a5e\n\n-- \nShawn.\n"}]}