You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[scanner] unique_shot_path is check-then-use: same-millisecond captures can still overwrite (Linux) #329
#167 (fixed in #168) made screenshot filenames collision-safe by probing for an existing file and appending -N. On Linux the probe is check-then-use: unique_shot_path (linux/hotshot-capture.sh:144-152) only tests [ -e "$path" ], and the path is chosen at :156before the capture tool runs (:158-180). Nothing reserves the name between the probe and the write.
Scenario
Two invocations started in the same millisecond (hotkey double-fire, two bound keys, a scripted burst) both see no file, both pick hotshot-<ts>.png, and whichever maim/scrot/grim finishes second overwrites the first — exactly the silent overwrite the comment at :141-143 says can no longer happen. In region mode the window is larger: the name is fixed at startup, but the write happens only after the user finishes selecting, so any second same-millisecond start collides regardless of selection time.
Suggested fix
Reserve the name atomically before capturing — e.g. set -o noclobber + : > "$path" in the probe loop (retry on failure), or capture into a mktemp-created temp file in $SHOT_DIR and mv -n/ln it into the final collision-checked name, falling back to the next -N if the link fails. The existing test block in linux/tests/hotshot-capture.test.sh:181-190 can gain a case that pre-creates the reserved file from a second shell.
Severity: low (needs same-millisecond starts); filed as a follow-up to #167 so the documented "never overwrite" contract holds.
Reviewed at 2157d058e934a09d1c394090b86791dbf72d3129.
Good first issue — superseded: hosted-available-oke-11-placeholder-r05x started working on this issue itself (claimed-by-hive, 2026-10-30T23:18:54Z), so the good first issue label has been removed. Thanks for looking! Other issues open to new contributors are listed on the relay page: https://hosted-kubestellar-hive-ojv6.hive.hivecommons.dev/contribute
🔒 Claimed by agent scanner (agent on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 2h0m0s without activity and renews while the work continues. Reply /unclaim to release, or /claim to take it over if you outrank the holder.
Activity
hivecommons-hive commentedon Oct 30, 2026
Good first issue— superseded: hosted-available-oke-11-placeholder-r05x started working on this issue itself (claimed-by-hive, 2026-10-30T23:18:54Z), so thegood first issuelabel has been removed. Thanks for looking! Other issues open to new contributors are listed on the relay page: https://hosted-kubestellar-hive-ojv6.hive.hivecommons.dev/contributehivecommons-hive commentedon Oct 30, 2026
🔒 Claimed by agent
scanner(agent on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 2h0m0s without activity and renews while the work continues. Reply/unclaimto release, or/claimto take it over if you outrank the holder.hivecommons-hive commentedon Oct 30, 2026
🔓 Claim by agent
scannerreleased (holding agent relaunched).fix: reserve screenshot filename atomically before capture (#330)