Skip to content

fix(cli): avoid cross-filesystem renames during installation - #35

Merged
batuhan merged 3 commits into
beeper:mainfrom
suatsulun:fix/download-cross-filesystem
Sep 25, 2026
Merged

batuhan merged 3 commits into
beeper:mainfrom
suatsulun:fix/download-cross-filesystem

Conversation

@suatsulun

Copy link
Copy Markdown
Contributor

Problem

Installing a runtime can fail when the system temporary directory and the installation directory are on different filesystems. For example, on Linux with /tmp on a separate mount, beeper setup --server --install --yes fails with:

EXDEV: cross-device link not permitted, rename '/tmp/<archive>.tmp' -> '~/.beeper/apps/server/<release>/<archive>'

downloadArtifact() writes the archive into os.tmpdir() and then calls rename() to move it into the installation directory. A rename cannot move a file across filesystems, so installation stops before extraction. This is an existing issue in upstream main; the shared download helper is used by Desktop and Server installation, including Server updates.

Change

Create the temporary file inside destinationDir instead of the system temporary directory, and remove the unused tmpdir import. The existing write-then-rename flow remains unchanged, with both paths on the same filesystem. No copy fallback or additional error-handling branch is needed.

Add one regression test that downloads from a local HTTP server into the checkout filesystem and checks the resulting path, file contents, and absence of leftover temporary files.

Validation

  • Confirmed that the new regression test fails with EXDEV against upstream main on Linux with /tmp and the checkout on different filesystems.
  • bun run test in packages/cli: build, generated README check, SDK-description check, command-manifest check, CLI smoke tests, and unit tests pass with the fix.
  • git diff --check passes.

The test reproduces the cross-filesystem failure when the checkout and system temporary directory are on different filesystems; on a single filesystem, it still checks successful download behavior.

suatsulun and others added 3 commits September 9, 2026 12:34
Poison TMPDIR instead of relying on the checkout and /tmp being on
different filesystems, so the regression test fails on a single-filesystem
CI runner too, and stop writing test directories into the package checkout.
Now that downloads stage next to the final artifact, a failed or
interrupted download would leave a .tmp file in the install directory.
batuhan added a commit to salmonumbrella/cli that referenced this pull request Sep 25, 2026
beeper#35 lands the same fix with tests; keep this PR to the launch changes.
@batuhan
batuhan merged commit 7597d2a into beeper:main Sep 25, 2026
3 checks passed
@batuhan

batuhan commented Sep 25, 2026

Copy link
Copy Markdown
Member

Thanks, this is the right fix: stage the download next to its destination and the rename can't cross filesystems. We added two small commits: the test now fails on single-filesystem CI too (it points TMPDIR at an unusable path and no longer writes into the checkout), and failed or interrupted downloads delete their partial .tmp from the install directory. Merged.

This action is being done autonomously.

This was referenced Sep 25, 2026
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.

2 participants