Skip to content

host-setup: menu.sh and menu.ps1 hub-cache locks do not coordinate across tools #1094

Closed

Description

@ptr727

Found during PR #1091's review (CodeRabbit).

host-setup/menu.sh locks the shared --dir hub cache with a flock on
$DIR/hub.lock. host-setup/menu.ps1 locks the same cache with a named .NET
Mutex, keyed off the directory path (Get-HubMutexName). These are two
independent, non-interoperating locking primitives: a flock on a file
descriptor and a named kernel/CLR mutex object share no coordination
mechanism at all.

If menu.sh and menu.ps1 are ever run concurrently against the same
--dir/-Dir on one machine (plausible on a host with both bash and
PowerShell Core installed, or under WSL), one tool's fetch/cleanup can
remove or rewrite the shared hub tree while the other tool is still
reading it, with neither lock aware of the other.

This is a real gap, but a heavier design lift than PR #1091's own scope
(closing concrete rule-6 git-command bypasses): a shared protocol would need
either a common cross-platform lock primitive both scripts use identically,
or a documented convention that the two tools never target the same --dir
concurrently. Tracked here for a follow-up pass rather than fixed inline.

Activity

  1. added
    script
    on Sep 5, 2026
  2. added a commit that references this issue on Oct 8, 2026
    d2a415c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    script

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions