From: "Martin Ågren" <martin.agren@gmail.com>
To: Derrick Stolee <dstolee@microsoft.com>
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>,
Jeff King <peff@peff.net>, Jakub Narebski <jnareb@gmail.com>,
Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH 00/12] Integrate commit-graph into fsck, gc, and fetch
Date: Thu, 10 May 2018 22:45:57 +0200 [thread overview]
Message-ID: <20180510204557.16361-1-martin.agren@gmail.com> (raw)
On 10 May 2018 at 21:22, Stefan Beller <sbeller@google.com> wrote:
> On Thu, May 10, 2018 at 12:05 PM, Martin Ågren <martin.agren@gmail.com> wrote:
>> I hope to find time to do some more hands-on testing of this to see that
>> errors actually do get caught.
> Packfiles and loose objects are primary data, which means that those
> need a more advanced way to diagnose and repair them, so I would imagine
> the commit graph fsck is closer to bitmaps fsck, which I would have suspected
> to be found in t5310, but a quick read doesn't reveal many tests that are
> checking for integrity. So I guess the test coverage here is ok, (although we
> should always ask for more)
Since I'm wrapping up for today, I'm posting some simple tests that I
assembled. The last of these showcases one or two problems with the
current error-reporting. Depending on the error, there can be *lots* of
errors reported and there are no new-lines, so the result on stdout can
be a wall of not-very-legible text.
Some of these might not make sense. I just started going through the
documentation on the format, causing some sort of corruption in each
field. Maybe this can be helpful somehow.
Martin
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 82f95eb11f..a7e48db2de 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -255,4 +255,49 @@ test_expect_success 'git fsck (checks commit-graph)' '
git fsck
'
+# usage: corrupt_data <file> <pos> [<data>]
+corrupt_data() {
+ file=$1
+ pos=$2
+ data="${3:-\0}"
+ printf "$data" | dd of="$file" bs=1 seek="$pos" conv=notrunc
+}
+
+test_expect_success 'detect bad signature' '
+ cd "$TRASH_DIRECTORY/full" &&
+ cp $objdir/info/commit-graph commit-graph-backup &&
+ test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
+ corrupt_data $objdir/info/commit-graph 0 "\0" &&
+ test_must_fail git commit-graph verify 2>err &&
+ grep "graph signature" err
+'
+
+test_expect_success 'detect bad version number' '
+ cd "$TRASH_DIRECTORY/full" &&
+ cp $objdir/info/commit-graph commit-graph-backup &&
+ test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
+ corrupt_data $objdir/info/commit-graph 4 "\02" &&
+ test_must_fail git commit-graph verify 2>err &&
+ grep "graph version" err
+'
+
+test_expect_success 'detect bad hash version' '
+ cd "$TRASH_DIRECTORY/full" &&
+ cp $objdir/info/commit-graph commit-graph-backup &&
+ test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
+ corrupt_data $objdir/info/commit-graph 5 "\02" &&
+ test_must_fail git commit-graph verify 2>err &&
+ grep "hash version" err
+'
+
+test_expect_success 'detect too small chunk-count' '
+ cd "$TRASH_DIRECTORY/full" &&
+ cp $objdir/info/commit-graph commit-graph-backup &&
+ test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
+ corrupt_data $objdir/info/commit-graph 6 "\01" &&
+ test_must_fail git commit-graph verify 2>err &&
+ cat err
+'
+
+
test_done
--
2.17.0
next reply other threads:[~2018-05-10 20:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 20:45 Martin Ågren [this message]
2018-05-11 12:30 ` [PATCH 00/12] Integrate commit-graph into fsck, gc, and fetch Derrick Stolee
-- strict thread matches above, loose matches on Subject: below --
2018-04-17 18:10 [RFC PATCH 00/12] Integrate commit-graph into 'fsck' and 'gc' Derrick Stolee
2018-05-10 17:34 ` [PATCH 00/12] Integrate commit-graph into fsck, gc, and fetch Derrick Stolee
2018-05-10 19:05 ` Martin Ågren
2018-05-10 19:22 ` Stefan Beller
2018-05-11 17:23 ` Derrick Stolee
2018-05-11 17:30 ` Martin Ågren
2018-05-10 19:17 ` Ævar Arnfjörð Bjarmason
2018-05-11 17:23 ` Derrick Stolee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180510204557.16361-1-martin.agren@gmail.com \
--to=martin.agren@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).