mbox series

[0/3] refs: small followups to the migration corruption fix

Message ID 20250117-461-corrupted-reftable-followup-v1-0-70ee605ae3fe@gmail.com (mailing list archive)
Headers show
Series refs: small followups to the migration corruption fix | expand

Message

Karthik Nayak Jan. 17, 2025, 7:59 a.m. UTC
This is a follow up to the bug that was reported [1] around `git refs
migrate --ref-format=reftable` where the migration would fail for
repositories with reflogs with lots of entries. This was caused due to a
mismatch in the reftable's header and footer, specifically WRT the
'max_update_index'.

While there was a fix posted. This series is a small followup to fix
some of the topics discussed there:
1. To mark `ref_transaction_update_reflog()` as static since it is only
used internally within 'refs.c'.
2. To change the type of 'max_index' from 'unsigned int' to 'uint64_t'.
This would be much safer for large repositories with millions of files
and on 32bit systems.
3. To add a safeguard to prevent 'update_index' changes after first
block is written. This is a preventive measure to ensure such bugs don't
arise in the future.

This is based on top of master 757161efcc (Sync with Git 2.48.1,
2025-01-13) with 'kn/reflog-migration-fix' merged in.

[1]: https://lore.kernel.org/r/Z4UbkcmJAU1MT-Rs@tapette.crustytoothpaste.net

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
Karthik Nayak (3):
      refs: mark `ref_transaction_update_reflog()` as static
      refs: use 'uint64_t' for 'ref_update.index'
      reftable: prevent 'update_index' changes after header write

 refs.c                  | 18 ++++++++++--------
 refs.h                  | 14 --------------
 refs/refs-internal.h    |  4 ++--
 refs/reftable-backend.c |  2 +-
 reftable/writer.c       |  7 +++++++
 5 files changed, 20 insertions(+), 25 deletions(-)
---



---

base-commit: a5aa44e7930761cb900813d971b4105f901818fb
change-id: 20250117-461-corrupted-reftable-followup-eb0e4fd1a723

Thanks
- Karthik