Re: [PATCH 02/11] multi-pack-index: verify bad header
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 7, 2018, 00:27 UTC
- Message-ID
- <CAPig+cSOcfQDYP+LEZxhRst__dXZUc=euoORZk0iGYrh9adm1A@mail.gmail.com>
- In-Reply-To
- <787e1fb61626afe79cfc846c4175d4b4d169ff42.1536158789.git.gitgitgadget@gmail.com>
On Wed, Sep 5, 2018 at 10:46 AM Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 11 quoted lines
> Add tests that check corrupted headers in a few ways:
> [...]
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
> diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
> @@ -154,6 +154,51 @@ test_expect_success 'verify multi-pack-index success' '
> +corrupt_midx_and_verify() {
> + POS=$1
> + DATA="${2:-\0}"
> + OBJDIR=$3
> + GREPSTR="$4"If you happen to re-roll, perhaps make these assignments part of the &&-chain to protect against someone coming along some day an inserting code before them without realizing that the &&-chain is broken.
Show 9 quoted lines
> + FILE=$OBJDIR/pack/multi-pack-index && > + chmod a+w $FILE && > + test_when_finished mv midx-backup $FILE && > + cp $FILE midx-backup && > + printf "$DATA" | dd of="$FILE" bs=1 seek="$POS" conv=notrunc && > + test_must_fail git multi-pack-index verify --object-dir=$OBJDIR 2>test_err && > + grep -v "^+" test_err >err && > + test_i18ngrep "$GREPSTR" err > +}