Skip to content

fix(install): stage runtime downloads under the dtvem root - #281

Closed
CalvinAllen wants to merge 1 commit into
mainfrom
fix/install/cross-drive-staging
Closed

CalvinAllen wants to merge 1 commit into
mainfrom
fix/install/cross-drive-staging

Conversation

@CalvinAllen

Copy link
Copy Markdown
Contributor

Summary

Installing any runtime failed when the dtvem root is on a different drive than the OS temp directory (e.g. DTVEM_ROOT=H:\SDKs\dtvem with Windows on C:):

✗ failed to move to install location: rename C:\Users\user\AppData\Local\Temp\dtvem-node-24.22.0\extracted H:\SDKs\dtven\versions\node\24.22.0: The system cannot move the file to a different disk drive.

All three providers downloaded and extracted into os.TempDir() and then os.Renamed the result into versions/. os.Rename can't move a directory across volumes on Windows, or across filesystems on Unix (so a tmpfs-backed /tmp has the same failure).

Changes

  • 📁 config.Paths gains Temp (<root>/tmp), plus StagingPath(runtime, version) and CreateStagingDir(runtime, version).
  • 🔀 Node, Python and Ruby installs stage in <root>/tmp/<runtime>-<version>, so the final move is always a same-volume rename (still atomic, no copying).
  • 🧹 CreateStagingDir clears leftovers from an interrupted install before reuse, since the OS temp cleaner no longer covers this location. The existing deferred cleanup still removes the staging dir after each install.

Testing

  • ✅ New tests in internal/config/paths_test.go: staging path layout, same volume as versions/, not inside versions/, directory creation, and stale-leftover removal.
  • ✅ ./rnr check passes; go vet and go test ./... also pass in a clean worktree of this commit alone.
  • ✅ End-to-end on Windows with a scratch DTVEM_ROOT: dtvem install node 24.22.0 staged under <root>\tmp, installed, node --version reports v24.22.0, and tmp\ was left empty.
  • ⚠️ Not reproduced on a real second drive: the only other drive on the dev machine is a Google Drive mount.

Resolves #278

Installs downloaded and extracted into os.TempDir() and then used
os.Rename to move the result into the versions directory. When the
dtvem root lives on a different drive than the OS temp directory
(e.g. DTVEM_ROOT on H: with Windows on C:), the rename fails with
"The system cannot move the file to a different disk drive". The same
happens on Unix when /tmp is a separate filesystem such as tmpfs.

Stage installs in <root>/tmp/<runtime>-<version> instead, so the final
move is always a same-volume rename. Leftovers from an interrupted
install are cleared before reuse since the OS no longer cleans them.
@CalvinAllen

Copy link
Copy Markdown
Contributor Author

Superseded by 83a3ecf. This commit was squash-merged into main as part of #280, and the five files are identical to what's here, so this PR has nothing left to merge. Closing.

@CalvinAllen
CalvinAllen deleted the fix/install/cross-drive-staging branch October 17, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot install runtimes if dtvem is on non-system drive

1 participant