git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] git fsck: check pack rev-index files
@ 2023-04-17 16:21 Derrick Stolee via GitGitGadget
  2023-04-17 16:21 ` [PATCH 1/4] fsck: create scaffolding for rev-index checks Derrick Stolee via GitGitGadget
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Derrick Stolee via GitGitGadget @ 2023-04-17 16:21 UTC (permalink / raw)
  To: git; +Cc: me, gitster, Derrick Stolee

This series is based on tb/pack-revindex-on-disk.

The git fsck builtin does not look at the .rev files that pair with .pack
and .idx files, but should. If these files suffer a bit flip on disk, then
the invalid data may cause fetches and clones from that repository to start
failing. The fix is simple: delete the .rev file (and regenerate, if
necessary), but detection is the first step.

This series adds those checks. The initial check to verify the checksum is
probably sufficient for most real-world scenarios, but going the extra mile
to verify the rev-index contents against an in-memory rev-index helps us be
sure that there isn't a bug in the rev-index writing code of Git (which
would result in a valid checksum). Much like other file formats, an invalid
header needs to be handled separately as a malformed header may prevent the
data structures from being initialized in the first place.

This series does not validate a multi-pack-index-<hash>.rev file or the
rev-index chunk of a multi-pack-index file. These could be fast-follows,
except that there is no existing equivalent for an in-memory rev-index for
easy comparison. The rev-index chunk (which is the most-common way for a
multi-pack-index to have this information) is already covered by existing
checksum validation, at least.

Thanks, -Stolee

Derrick Stolee (4):
  fsck: create scaffolding for rev-index checks
  fsck: check rev-index checksums
  fsck: check rev-index position values
  fsck: validate .rev file header

 builtin/fsck.c           | 36 +++++++++++++++++++
 pack-bitmap.c            |  4 +--
 pack-revindex.c          | 43 +++++++++++++++++++++--
 pack-revindex.h          | 16 +++++++++
 t/t5325-reverse-index.sh | 74 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 169 insertions(+), 4 deletions(-)


base-commit: 9f7f10a282d8adeb9da0990aa0eb2adf93a47ca7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1512%2Fderrickstolee%2Ffsck-rev-indexes-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1512/derrickstolee/fsck-rev-indexes-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1512
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-04-18 16:59 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 16:21 [PATCH 0/4] git fsck: check pack rev-index files Derrick Stolee via GitGitGadget
2023-04-17 16:21 ` [PATCH 1/4] fsck: create scaffolding for rev-index checks Derrick Stolee via GitGitGadget
2023-04-17 22:20   ` Taylor Blau
2023-04-17 16:21 ` [PATCH 2/4] fsck: check rev-index checksums Derrick Stolee via GitGitGadget
2023-04-17 22:15   ` Junio C Hamano
2023-04-18 14:24     ` Derrick Stolee
2023-04-17 22:24   ` Taylor Blau
2023-04-18 14:27     ` Derrick Stolee
2023-04-18 14:51       ` Taylor Blau
2023-04-18 14:57         ` Derrick Stolee
2023-04-18 15:03           ` Taylor Blau
2023-04-17 16:21 ` [PATCH 3/4] fsck: check rev-index position values Derrick Stolee via GitGitGadget
2023-04-17 22:01   ` Junio C Hamano
2023-04-18 14:32     ` Derrick Stolee
2023-04-17 22:52   ` Taylor Blau
2023-04-17 16:21 ` [PATCH 4/4] fsck: validate .rev file header Derrick Stolee via GitGitGadget
2023-04-17 21:37 ` [PATCH 0/4] git fsck: check pack rev-index files Junio C Hamano
2023-04-18 15:23 ` Taylor Blau
2023-04-18 16:59   ` Junio C Hamano

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 NNTP newsgroup(s).