Skip to content

gix-ref v0.66.0

Choose a tag to compare

@Byron Byron released this 23 Jul 13:23
842bc44

Bug Fixes

  • remove global lock optimization to align with Git
    Previously, a transaction would rely on the packed-refs lock
    only when available, and skip per-ref locks entirely.

    This would, however, incorrectly serialise ref writers globally,
    giving it the same write performance as ref-tables, while allowing
    races with Git processes.

  • check Windows device names before acquiring lock
    Move the prohibit_windows_device_names validation ahead of lock
    acquisition in lock_ref_and_apply_change(). Previously the check
    ran inside ref_contents(), which is called by read_existing_ref()
    after the .lock file was already created. For a ref such as
    refs/heads/CON the lock path CON.lock is itself a reserved Windows
    device name, so prepare() would fail during lock acquisition (or
    open the device) rather than returning the configured validation
    error.

    Extract the device-name check from ref_contents() into a new
    check_windows_device_name() helper on the store and call it at the
    top of lock_ref_and_apply_change(), before either the Delete or
    Update branch tries to acquire a lock. ref_contents() still
    delegates to the same helper for callers that read refs outside the
    transaction path.

  • close TOCTOU race in CAS check during ref transaction prepare
    Read the existing ref value after acquiring the lock rather than before,
    so the PreviousValue check compares against a value that cannot be
    changed concurrently. Without this, two transactions can both read the
    old value, serialize through the lock, and both pass the CAS check —
    silently losing one update.

    The TOCTOU fix moved the existing-ref read under the lock, which for the
    Change::Update branch is now after lock acquisition. A path-prefix
    collision (creating a/b while a is a ref file) therefore surfaced via
    the lock's create_dir_all as AlreadyExists, reported as the misleading
    LockAcquire(PermanentlyLocked) rather than the historical
    Io(NotADirectory).

    Thanks to the gix-fs fix, lock-acquisition I/O errors surface as Error::Io
    (reserving Error::LockAcquire for actual contention), which restores the
    historical Io(NotADirectory) for path-prefix collisions in the
    Change::Update branch.

Commit Statistics

  • 17 commits contributed to the release.
  • 31 days passed between releases.
  • 3 commits were understood as conventional.
  • 0 issues like '(#ID)' were seen in commit messages

Thanks Clippy

Clippy helped 1 time to make code idiomatic.

Commit Details

view details
  • Uncategorized
    • Update changelogs prior to release (cb6ec7d)
    • Release gix-trace v0.1.21, gix-validate v0.11.3, gix-path v0.12.3, gix-utils v0.3.5, gix-config-value v0.19.0, gix-prompt v0.16.0, gix-sec v0.14.2, gix-url v0.37.0, gix-credentials v0.39.0, safety bump 18 crates (f0ec710)
    • Merge pull request #2722 from GitoxideLabs/reasons (c16b5a1)
    • Replace lint allowances with expectations (43ff87a)
    • Merge pull request #2714 from GitoxideLabs/fix-credentials-parsing (cf3053a)
    • Release gix-path v0.12.2, gix-error v0.2.5, gix-utils v0.3.4, gix-date v0.15.6, gix-url v0.36.2, gix-credentials v0.38.2 (27aec47)
    • Merge pull request #2702 from ameyypawar/fix/2694-exn-source-chain (e9c973d)
    • Thanks clippy (d533f0c)
    • Merge pull request #2674 from GitoxideLabs/fix-ref-transaction-toctou (7471d07)
    • Remove global lock optimization to align with Git (cde8272)
    • Merge pull request #2659 from willstott101/fix-ref-transaction-toctou (43dd683)
    • Review (7a1ebfb)
    • Check Windows device names before acquiring lock (4aae425)
    • Close TOCTOU race in CAS check during ref transaction prepare (8480e2a)
    • Merge pull request #2670 from GitoxideLabs/fix-ci (d785bbc)
    • Update mmap2 to avoid potential for unsoundness (eda41b1)
    • Merge pull request #2646 from GitoxideLabs/report (1b1541e)