fix(lock): use TMPDIR with /tmp fallback for default lock path#1081
fix(lock): use TMPDIR with /tmp fallback for default lock path#1081tmchow wants to merge 1 commit intoamber-lang:stagingfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChanged the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
any chance this can get merged? got 2 approvals and CI is green. happy to rebase if needed. |
|
@tmchow we are working in this days to finalize the 0.6.0 release so we think to postpone the merge of your PR when that version is released. |
Thanks for letting me know! |
The lock builtin hardcoded /tmp for default lock file paths, which fails on environments like Termux where /tmp is not accessible. Use the TMPDIR environment variable with a /tmp fallback instead. Fixes amber-lang#1018
eb1e518 to
2a7023c
Compare
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
Summary
The
lockbuiltin hardcodes/tmpfor default lock file paths. This fails on Termux (Android terminal emulator) where/tmpis not accessible due to Android's app sandboxing.Changes
src/modules/builtin/lock.rs: Replace hardcoded/tmpwith${TMPDIR:-/tmp}in the generated Bash fragment. This respects theTMPDIRenvironment variable (which Termux sets to a writable directory) and falls back to/tmpon standard systems.src/tests/compiling.rs: Add a regression test verifying the generated lock path contains the TMPDIR-based pattern.The fix is a single character-level change to the Bash template string. On Termux,
TMPDIRpoints to/data/data/com.termux/files/usr/tmp. On standard Linux/macOS,TMPDIRis either unset (so/tmpis used) or set to a system-appropriate directory.Testing
cargo testpasses (653 tests, 0 failures)cargo clippypasses with no warningstest_lock_default_path_uses_tmpdir_with_tmp_fallbackverifies the generated Bash contains${TMPDIR:-/tmp}/${0##*/}.lockFixes #1018
This contribution was developed with AI assistance (Codex).
Summary by CodeRabbit
New Features
Tests