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

[PATCH v4 15/21] commit-graph: test for corrupted octopus edge

From
Derrick Stolee <dstolee@microsoft.com>
Date
Jun 4, 2018, 16:52 UTC
Message-ID
<20180604165200.29261-16-dstolee@microsoft.com>
In-Reply-To
<20180604165200.29261-1-dstolee@microsoft.com>

The commit-graph file has an extra chunk to store the parent int-ids for parents beyond the first parent for octopus merges. Our test repo has a single octopus merge that we can manipulate to demonstrate the 'verify' subcommand detects incorrect values in that chunk.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 t/t5318-commit-graph.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 6a873bfda8..cf67fb391a 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -248,6 +248,7 @@ test_expect_success 'git commit-graph verify' '
 '
 
 NUM_COMMITS=9
+NUM_OCTOPUS_EDGES=2
 HASH_LEN=20
 GRAPH_BYTE_VERSION=4
 GRAPH_BYTE_HASH=5
@@ -274,6 +275,10 @@ GRAPH_BYTE_COMMIT_EXTRA_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 4))
 GRAPH_BYTE_COMMIT_WRONG_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 3))
 GRAPH_BYTE_COMMIT_GENERATION=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 11))
 GRAPH_BYTE_COMMIT_DATE=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 12))
+GRAPH_COMMIT_DATA_WIDTH=$(($HASH_LEN + 16))
+GRAPH_OCTOPUS_DATA_OFFSET=$(($GRAPH_COMMIT_DATA_OFFSET + \
+			     $GRAPH_COMMIT_DATA_WIDTH \* $NUM_COMMITS))
+GRAPH_BYTE_OCTOPUS=$(($GRAPH_OCTOPUS_DATA_OFFSET + 4))
 
 # usage: corrupt_graph_and_verify <position> <data> <string>
 # Manipulates the commit-graph file at the position
@@ -383,4 +388,9 @@ test_expect_success 'detect incorrect commit date' '
 		"commit date"
 '
 
+test_expect_success 'detect incorrect parent for octopus merge' '
+	corrupt_graph_and_verify $GRAPH_BYTE_OCTOPUS "\01" \
+		"invalid parent"
+'
+
 test_done
-- 
2.18.0.rc1
Previous: Derrick StoleeNext: Derrick Stolee
Message 24 of 125 in “Integrate commit-graph into 'fsck' and 'gc'”
  1. 00/21 Integrate commit-graph into 'fsck' and 'gc'Derrick Stolee, Jun 4, 2018
  2. 01/21 commit-graph: UNLEAK before die()Derrick Stolee, Jun 4, 2018
  3. 02/21 commit-graph: fix GRAPH_MIN_SIZEDerrick Stolee, Jun 4, 2018
  4. 03/21 commit-graph: parse commit from chosen graphDerrick Stolee, Jun 4, 2018
  5. 05/21 commit-graph: load a root tree from specific graphDerrick Stolee, Jun 4, 2018
  6. 07/21 commit-graph: verify catches corrupt signatureDerrick Stolee, Jun 4, 2018
  7. 06/21 commit-graph: add 'verify' subcommandDerrick Stolee, Jun 4, 2018
  8. 08/21 commit-graph: verify required chunks are presentDerrick Stolee, Jun 4, 2018
  9. 09/21 commit-graph: verify corrupt OID fanout and lookupDerrick Stolee, Jun 4, 2018
  10. 11/21 commit-graph: verify root tree OIDsDerrick Stolee, Jun 4, 2018
  11. 12/21 commit-graph: verify parent listDerrick Stolee, Jun 4, 2018
  12. 10/21 commit-graph: verify objects existDerrick Stolee, Jun 4, 2018
  13. 18/21 commit-graph: use string-list API for inputDerrick Stolee, Jun 4, 2018
  14. 20/21 gc: automatically write commit-graph filesDerrick Stolee, Jun 4, 2018
  15. Ævar Arnfjörð BjarmasonJun 6, 2018
  16. 19/21 commit-graph: add '--reachable' optionDerrick Stolee, Jun 4, 2018
  17. 21/21 commit-graph: update design documentDerrick Stolee, Jun 4, 2018
  18. 13/21 commit-graph: verify generation numberDerrick Stolee, Jun 4, 2018
  19. 17/21 fsck: verify commit-graphDerrick Stolee, Jun 4, 2018
  20. Ævar Arnfjörð BjarmasonJun 6, 2018
  21. Derrick StoleeJun 6, 2018
  22. 16/21 commit-graph: verify contents match checksumDerrick Stolee, Jun 4, 2018
  23. 14/21 commit-graph: verify commit dateDerrick Stolee, Jun 4, 2018
  24. 15/21 commit-graph: test for corrupted octopus edgeDerrick Stolee, Jun 4, 2018
  25. 04/21 commit: force commit to parse from object databaseDerrick Stolee, Jun 4, 2018
  26. Derrick StoleeJun 4, 2018
  27. Ævar Arnfjörð BjarmasonJun 5, 2018
  28. Derrick StoleeJun 5, 2018
  29. 00/21 Integrate commit-graph into 'fsck' and 'gc'Derrick Stolee, Jun 6, 2018
  30. 05/21 commit-graph: load a root tree from specific graphDerrick Stolee, Jun 6, 2018
  31. 17/21 fsck: verify commit-graphDerrick Stolee, Jun 6, 2018
  32. 15/21 commit-graph: test for corrupted octopus edgeDerrick Stolee, Jun 6, 2018
  33. 21/21 commit-graph: update design documentDerrick Stolee, Jun 6, 2018
  34. 13/21 commit-graph: verify generation numberDerrick Stolee, Jun 6, 2018
  35. 20/21 gc: automatically write commit-graph filesDerrick Stolee, Jun 6, 2018
  36. 10/21 commit-graph: verify objects existDerrick Stolee, Jun 6, 2018
  37. 19/21 commit-graph: add '--reachable' optionDerrick Stolee, Jun 6, 2018
  38. 03/21 commit-graph: parse commit from chosen graphDerrick Stolee, Jun 6, 2018
  39. 18/21 commit-graph: use string-list API for inputDerrick Stolee, Jun 6, 2018
  40. Ævar Arnfjörð BjarmasonJun 6, 2018
  41. Derrick StoleeJun 6, 2018
  42. Ævar Arnfjörð BjarmasonJun 6, 2018
  43. Derrick StoleeJun 6, 2018
  44. Derrick StoleeJun 8, 2018
  45. 06/21 commit-graph: add 'verify' subcommandDerrick Stolee, Jun 6, 2018
  46. 16/21 commit-graph: verify contents match checksumDerrick Stolee, Jun 6, 2018
  47. 09/21 commit-graph: verify corrupt OID fanout and lookupDerrick Stolee, Jun 6, 2018
  48. 04/21 commit: force commit to parse from object databaseDerrick Stolee, Jun 6, 2018
  49. 14/21 commit-graph: verify commit dateDerrick Stolee, Jun 6, 2018
  50. 07/21 commit-graph: verify catches corrupt signatureDerrick Stolee, Jun 6, 2018
  51. 08/21 commit-graph: verify required chunks are presentDerrick Stolee, Jun 6, 2018
  52. Ævar Arnfjörð BjarmasonJun 6, 2018
  53. 12/21 commit-graph: verify parent listDerrick Stolee, Jun 6, 2018
  54. 11/21 commit-graph: verify root tree OIDsDerrick Stolee, Jun 6, 2018
  55. 01/21 commit-graph: UNLEAK before die()Derrick Stolee, Jun 6, 2018
  56. 02/21 commit-graph: fix GRAPH_MIN_SIZEDerrick Stolee, Jun 6, 2018
  57. 00/21 Integrate commit-graph into 'fsck' and 'gc'Derrick Stolee, Jun 8, 2018
  58. 02/21 commit-graph: fix GRAPH_MIN_SIZEDerrick Stolee, Jun 8, 2018
  59. 03/21 commit-graph: parse commit from chosen graphDerrick Stolee, Jun 8, 2018
  60. 05/21 commit-graph: load a root tree from specific graphDerrick Stolee, Jun 8, 2018
  61. 06/21 commit-graph: add 'verify' subcommandDerrick Stolee, Jun 8, 2018
  62. 09/21 commit-graph: verify corrupt OID fanout and lookupDerrick Stolee, Jun 8, 2018
  63. 12/21 commit-graph: verify parent listDerrick Stolee, Jun 8, 2018
  64. Junio C HamanoJun 12, 2018
  65. 10/21 commit-graph: verify objects existDerrick Stolee, Jun 8, 2018
  66. 17/21 fsck: verify commit-graphDerrick Stolee, Jun 8, 2018
  67. 21/21 commit-graph: update design documentDerrick Stolee, Jun 8, 2018
  68. 16/21 commit-graph: verify contents match checksumDerrick Stolee, Jun 8, 2018
  69. 18/21 commit-graph: use string-list API for inputDerrick Stolee, Jun 8, 2018
  70. 19/21 commit-graph: add '--reachable' optionDerrick Stolee, Jun 8, 2018
  71. 15/21 commit-graph: test for corrupted octopus edgeDerrick Stolee, Jun 8, 2018
  72. 20/21 gc: automatically write commit-graph filesDerrick Stolee, Jun 8, 2018
  73. SZEDER GáborJun 8, 2018
  74. Derrick StoleeJun 25, 2018
  75. 11/21 commit-graph: verify root tree OIDsDerrick Stolee, Jun 8, 2018
  76. 14/21 commit-graph: verify commit dateDerrick Stolee, Jun 8, 2018
  77. 13/21 commit-graph: verify generation numberDerrick Stolee, Jun 8, 2018
  78. 08/21 commit-graph: verify required chunks are presentDerrick Stolee, Jun 8, 2018
  79. 07/21 commit-graph: verify catches corrupt signatureDerrick Stolee, Jun 8, 2018
  80. 04/21 commit: force commit to parse from object databaseDerrick Stolee, Jun 8, 2018
  81. 01/21 commit-graph: UNLEAK before die()Derrick Stolee, Jun 8, 2018
  82. Jakub NarębskiJun 8, 2018
  83. Derrick StoleeJun 8, 2018
  84. 00/22 Integrate commit-graph into 'fsck' and 'gc'Derrick Stolee, Jun 27, 2018
  85. 01/22 t5318-commit-graph.sh: use core.commitGraphDerrick Stolee, Jun 27, 2018
  86. Junio C HamanoJun 27, 2018
  87. 02/22 commit-graph: UNLEAK before die()Derrick Stolee, Jun 27, 2018
  88. 03/22 commit-graph: fix GRAPH_MIN_SIZEDerrick Stolee, Jun 27, 2018
  89. 05/22 commit: force commit to parse from object databaseDerrick Stolee, Jun 27, 2018
  90. 04/22 commit-graph: parse commit from chosen graphDerrick Stolee, Jun 27, 2018
  91. 06/22 commit-graph: load a root tree from specific graphDerrick Stolee, Jun 27, 2018
  92. SZEDER GáborJul 11, 2018
  93. coccinelle: update commit.cocciDerrick Stolee, Jul 13, 2018
  94. Eric SunshineJul 13, 2018
  95. 08/22 commit-graph: verify catches corrupt signatureDerrick Stolee, Jun 27, 2018
  96. 07/22 commit-graph: add 'verify' subcommandDerrick Stolee, Jun 27, 2018
  97. Jonathan TanJun 27, 2018
  98. Derrick StoleeJun 29, 2018
  99. 12/22 commit-graph: verify root tree OIDsDerrick Stolee, Jun 27, 2018
  100. 13/22 commit-graph: verify parent listDerrick Stolee, Jun 27, 2018
  101. 14/22 commit-graph: verify generation numberDerrick Stolee, Jun 27, 2018
  102. 16/22 commit-graph: test for corrupted octopus edgeDerrick Stolee, Jun 27, 2018
  103. 18/22 fsck: verify commit-graphDerrick Stolee, Jun 27, 2018
  104. 17/22 commit-graph: verify contents match checksumDerrick Stolee, Jun 27, 2018
  105. Junio C HamanoJun 27, 2018
  106. 11/22 commit-graph: verify objects existDerrick Stolee, Jun 27, 2018
  107. 10/22 commit-graph: verify corrupt OID fanout and lookupDerrick Stolee, Jun 27, 2018
  108. 22/22 commit-graph: update design documentDerrick Stolee, Jun 27, 2018
  109. Junio C HamanoJun 27, 2018
  110. 15/22 commit-graph: verify commit dateDerrick Stolee, Jun 27, 2018
  111. 21/22 gc: automatically write commit-graph filesDerrick Stolee, Jun 27, 2018
  112. Junio C HamanoJun 27, 2018
  113. Derrick StoleeJun 27, 2018
  114. SZEDER GáborAug 3, 2018
  115. t5318: use 'test_cmp_bin' to compare commit-graph filesSZEDER Gábor, Aug 12, 2018
  116. Derrick StoleeAug 13, 2018
  117. SZEDER GáborAug 13, 2018
  118. t5318: use 'test_cmp_bin' to compare commit-graph filesSZEDER Gábor, Aug 13, 2018
  119. 20/22 commit-graph: add '--reachable' optionDerrick Stolee, Jun 27, 2018
  120. Junio C HamanoJun 27, 2018
  121. Christian CouderSep 11, 2018
  122. Derrick StoleeSep 11, 2018
  123. Christian CouderSep 11, 2018
  124. 09/22 commit-graph: verify required chunks are presentDerrick Stolee, Jun 27, 2018
  125. 19/22 commit-graph: use string-list API for inputDerrick Stolee, Jun 27, 2018

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.