question-streaks lock: release removes a lock it no longer owns

Open
#192 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, shell
Domain
tooling

Research direction

Start in bin/question-streaks.sh at the age check [ "$age" -gt 120 ] that reclaims $LOCK, then follow the release path that calls rmdir without checking ownership. Read the owner-token fix referenced from PR #191 and port that token write/check pattern here, re-checking the token before each rename under the lock. Add a test where holder A stalls past 120 s, B reclaims, and A's release leaves B's lock intact; done when that test and the existing script tests pass.

Written by the indexing model from the issue text.

Description

bin/question-streaks.sh reclaims a lock older than 120 s by age ([ "$age" -gt 120 ] && { rmdir "$LOCK"), and its release removes the lock without checking who holds it. A holder that stalls past 120 s then deletes the reclaimer's lock, and a third writer can race the second.

Same class as the P0 found in the thread index on https://github.com/STRML/autodream/pull/191, fixed there with an owner token that release checks before rmdir, and a token re-check before every rename under the lock. Port that pattern here, with a test where A's aged lock is reclaimed by B and A's release must leave B's lock alone.

Dominant language
Shell
Stars
0
Forks
2
Avg merge
11h 31m
Merged PRs (30d)
26

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from STRML/autodream

All issues in STRML/autodream

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.