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

[PATCH 1/2] t5303: drop "count=1" from corruption dd

From
Jeff King <peff@peff.net>
Date
Jun 14, 2013, 21:51 UTC
Message-ID
<20130614215100.GA3821@sigill.intra.peff.net>
In-Reply-To
<20130614214943.GA29138@sigill.intra.peff.net>

This test corrupts pack objects by using "dd" with a seek command. It passes "count=1 bs=1" to munge just a single byte. However, the test added in commit b3118bdc wants to munge two bytes, and the second byte of corruption is silently ignored.

This turned out not to impact the test, however. The idea was to reduce the "size of this entry" part of the header so that zlib runs out of input bytes while inflating the entry. That header is two bytes long, and the test reduced the value of both bytes; since we experience the problem if we are off by even 1 byte, it is sufficient to munge only the first one.

Even though the test would have worked with only a single byte munged, and we could simply tweak the test to use a single byte, it makes sense to lift this 1-byte restriction from do_corrupt_object. It will allow future tests that do need to change multiple bytes to do so.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5303-pack-corruption-resilience.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh
index 5b1250f..9cb8172 100755
--- a/t/t5303-pack-corruption-resilience.sh
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -51,7 +51,7 @@ do_corrupt_object() {
     ofs=`git show-index < ${pack}.idx | grep $1 | cut -f1 -d" "` &&
     ofs=$(($ofs + $2)) &&
     chmod +w ${pack}.pack &&
-    dd of=${pack}.pack count=1 bs=1 conv=notrunc seek=$ofs &&
+    dd of=${pack}.pack bs=1 conv=notrunc seek=$ofs &&
     test_must_fail git verify-pack ${pack}.pack
 }
 
-- 
1.8.3.rc2.14.g7eee6b3
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 11 in “unpack_entry: do not die when we fail to apply a delta”
  1. unpack_entry: do not die when we fail to apply a deltaJeff King, Jun 13, 2013
  2. Nicolas PitreJun 14, 2013
  3. 0/2 recover from "failed to apply delta"Jeff King, Jun 14, 2013
  4. 1/2 t5303: drop "count=1" from corruption ddJeff King, Jun 14, 2013
  5. Junio C HamanoJun 14, 2013
  6. Jeff KingJun 14, 2013
  7. Junio C HamanoJun 14, 2013
  8. 2/2 unpack_entry: do not die when we fail to apply a deltaJeff King, Jun 14, 2013
  9. Junio C HamanoJun 14, 2013
  10. Jeff KingJun 14, 2013
  11. Junio C HamanoJun 14, 2013

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.