Use $TMPDIR for lockdir instead of hardcoded /tmp#161
Open
davidj4tech wants to merge 1 commit into
Open
Conversation
The autosave lockdir prefix is hardcoded to /tmp/, which breaks on
systems where /tmp is not user-writable. On Termux (Android), /tmp is
owned by the Android `shell` group with mode 0771, so non-shell users
cannot mkdir inside it; the writable tmp lives at $TMPDIR
(/data/data/com.termux/files/usr/tmp).
When mkdir fails there, acquire_lock returns 1, the save is skipped,
and autosave stops permanently with no log or status indication. The
only outward sign is that tmux_resurrect_*.txt snapshots stop updating
even though continuum_save.sh is still invoked on every status-line
refresh.
Use ${TMPDIR:-/tmp} so the lockdir follows the environment's notion of
a writable tmp directory. Falls back to /tmp when TMPDIR is unset,
preserving existing behavior on Linux/macOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The autosave lockdir prefix in
scripts/continuum_save.shis hardcoded to/tmp/. On systems where/tmpis not user-writable,mkdir "$lockdir1"fails withPermission denied,acquire_lockreturns 1, and autosave stops silently — no log, no status-line indication. The only outward sign is thattmux_resurrect_*.txtsnapshots stop updating, even thoughcontinuum_save.shcontinues to be invoked on every status-line refresh.Where this bites
Termux on Android.
/tmpis owned by the Androidshellgroup with mode0771:Non-
shellusers (your normal Termux user isu0_a*) cannot create entries inside it. The writable tmp lives at$TMPDIR, typically/data/data/com.termux/files/usr/tmp. Same shape applies to any sandbox or container where/tmpis mounted read-only or owned by another user.Diagnosis trace
This has been the behavior since the lockdir code was introduced in 800488c (2019).
Fix
Use
${TMPDIR:-/tmp}so the lockdir follows the environment's notion of a writable tmp directory. Falls back to/tmpwhenTMPDIRis unset, preserving existing behavior on Linux and macOS.Verified
On Termux (Android, Debian proot, user
u0_a2):continuum_save.shfails atmkdir, no snapshots written for days despite the script firing on every status refresh.mkdirsucceeds in$TMPDIR,fetch_and_run_tmux_resurrect_save_scriptruns, freshtmux_resurrect_*.txtappears and thelastsymlink updates. Subsequent runs are correctly throttled by the existing timestamp gate.No behavioral change on systems where
TMPDIRis unset or already/tmp.