Repository navigation
Description
Situation
People often keep Minimal's state directory on another disk through a symbolic link: ~/.local/state/minimal -> /Volumes/big/minimal. On macOS that directory holds the VM data volume, which can grow to 256 GiB. scripts/install.sh at main, from #3848 (gominimal/inbox#1330), mishandles this layout in two ways.
1. The archive lands on the wrong disk.
archive_box_statecopies the contents of the resolved state intoarchive_dest="$box_state.<version>"(install.sh:1350-1356), which is beside the link, on the link's disk.- The copy therefore crosses filesystems, so the
cp -cor--reflinkclone can never work and the copy is always a full one. - The space check measures the link's disk (
df -Pk "${box_state%/*}", :1376), not the data's.
2. The way back restores onto the wrong disk.
- The R2.6 refusal (
refuse_over_0_8_state, :1272) printsmv <state> <state>.0.8 && mv <newest copy> <state>, with<state>being the link. - That renames the link aside, and renames the copy (on the home disk) into the link's place.
- The 0.7 state comes back as a plain directory on the home disk. The 0.8 data stays on the other disk, behind a link that is now named
<state>.0.8.
Work
Resolve the state directory once, with cd -P and pwd -P. Call the result <target>. When it differs from $box_state (a link):
The archive goes beside the target, on the data's disk.
archive_dest="<target>.<version>", with the same.<t0>and.<t0>.<pid>suffixes when that name is taken.- The clone is tried there, and the space check runs
df -Pkon<target>'s parent. - The closing card names that path.
The refusal's restore acts on the target and keeps the link.
- The printed line becomes
mv <target> <target>.0.8 && mv <newest copy beside target> <target>, with the same free-name rule for<target>.0.8. - Both moves are renames on one filesystem. The link itself is never moved.
- The newest-copy search looks beside
<target>first, then beside the link, which is where fix: install.sh archives the box state on a 0.7 to 0.8 upgrade, refuses 0.7.x over 0.8 state, and #3848's archives landed. It names the newest by modification time and counts the others, as now. - A copy found only beside the link is named with a
cpinto a new directory beside<target>, then the rename. The printed line must notmvacross filesystems.
When the state directory is not a link, the behaviour is unchanged.
Tests (scripts/install_test.sh)
- The archive with a symlinked state: an upgrade from a stub 0.7.3 over
minimal -> <other dir>/minimalmakes<other dir>/minimal.0.7.3, a real directory whose contents match. The link is unchanged. - The refusal with a symlinked state: the printed restore line names
<other dir>/minimal, not the link. Running it leaves the link in place and pointing at the restored 0.7 state. - A pre-fix: install.sh archives the box state on a 0.7 to 0.8 upgrade, refuses 0.7.x over 0.8 state, and #3848 archive beside the link: it is found, and the printed steps copy it beside the target, then rename it.
- A plain state directory: the output is the same as before. The existing cases cover this.
The installer spec 07 gets the same change: R5.7's archive location and R2.6's restore line, for a symlinked state directory.
Activity
agent-137 commentedon Nov 28, 2026
Fixed by #3867 (D3862, task #3866), merged as d3bafd0.