Repository navigation
fix(terminal): auto-provision Linux sandbox before running commands - #2962
nicorudorlk22-gif wants to merge 2 commits into
Conversation
Ensures the Alpine sandbox is provisioned automatically before executing terminal commands, so the built-in terminal works out of the box.
Adds a guard so the sandbox installation check no longer loops forever when provisioning takes longer than expected.
|
| // check, init-sandbox.sh does not exist yet and the caller sees a confusing | ||
| // "No such file or directory" + unknown node/npm versions instead of the | ||
| // sandbox being set up automatically. | ||
| if (!this._provisioning && !(await this.isInstalled())) { |
There was a problem hiding this comment.
Setup calls delete shared files
Two concurrent startAxs(true) calls can both read _provisioning as false before awaiting isInstalled(). Both then call install(). Each install deletes the same sandbox before extracting it, so one can remove files the other needs and make setup fail.
Store and share a pending installation promise before the first await, and keep the internal configuration call separate from outside callers.
| this._provisioning = true; | ||
| let installed; | ||
| try { | ||
| installed = await this.install(logger, err_logger); |
There was a problem hiding this comment.
The normal first-run UI calls Terminal.install() directly, but install() never sets _provisioning. Its final startAxs(true) reaches this branch while .configured is still missing and starts another full install. The second install deletes the files just extracted, extracts them again, and repeats every download on F-Droid.
Set the guard for the whole install() call, or let its final configuration call bypass provisioning.
|
Hello @nicorudorlk22-gif we will not accept any changes in terminal related stuff for some time due to ongoing migration |
What it does
Reopens the work from #2956 (closed before review) rebased onto the current
main— both original commits cherry-picked cleanly, zero conflicts.Problem: callers that invoke
Terminal.startAxs()before the Alpine sandbox has ever been provisioned (core terminal UI on first run, or third-party plugins such as AI copilots that shell out tonpm/node) hit a confusing "No such file or directory" oninit-sandbox.shand unknown node/npm versions, instead of the sandbox being set up.Fix:
startAxs()now guards: if the sandbox is not installed and the caller is notinstall()itself, it auto-provisions (install then continue) — or throws a clear, actionable error message viaerr_logger._provisioningflag prevents the internalstartAxs(true, ...)call insideinstall()from re-enteringinstall()and recursing forever.Notes
node --checkpasses on the final file.