oliver-zehentleitner / maity
runner: one file-lock helper for tools and serve; serve takes serve.lock before building the service
tsk-zn4bnfwgpst3 Open
Audit round 3b (tsk-hgnbapyw7hnh), read at 80fef076. Kind: duplication / design.
What is wrong
- Two flock helpers:
tools.locked(cli/src/maity/runner/tools.py:119-140, context manager, wait option, raisesBusy, Windows no-op branch) andserve.hold_lock(cli/src/maity/runner/serve.py:306-318, returns a handle, raisesFatal, importsfcntlwith no Windows guard). No otherfcntluser in the runner. serve()callsopen_service(serve.py:406) beforehold_lock(serve.py:407): a secondserve, or one started whilemaity runner stop-allholdsserve.lock(operate.py:156), first probes every harness, connects to every ssh target and builds Supervisor and Keeper, and only then is refused.
Proposal
- One
exclusive(path, *, wait)helper used by both modules. - In
serve(), take the lock right afterconfig.load, beforeopen_service.
Effort / risk: S. Low.