Skip to content

Fix cross-device link error when running in Docker with volumes#66

Merged
andrew merged 1 commit intomainfrom
fix-cross-device-rename
Apr 6, 2026
Merged

Fix cross-device link error when running in Docker with volumes#66
andrew merged 1 commit intomainfrom
fix-cross-device-rename

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented Apr 6, 2026

fileblob creates temp files in os.TempDir() (/tmp) by default, then uses os.Rename to move them to the final path. When the storage directory is on a different filesystem (e.g. a Docker volume mount at /data), the rename fails with "invalid cross-device link".

Sets no_tmp_dir=true on file:// bucket URLs so fileblob creates temp files next to the final destination instead. This is the documented solution from fileblob.

Verified end-to-end with docker compose up — the exact request from #65 (/composer/files/friendsofphp/php-cs-fixer/v3.94.2/...) now returns 200 with a volume mount.

Fixes #65

`fileblob` creates temp files in `os.TempDir()` (`/tmp`) by default,
then uses `os.Rename` to move them to the final path. When the storage
directory is on a different filesystem (e.g. a Docker volume mount at
`/data`), the rename fails with "invalid cross-device link".

Set `no_tmp_dir=true` on file:// bucket URLs so fileblob creates temp
files next to the final destination instead.

Fixes #65
@andrew andrew merged commit 24d5e77 into main Apr 6, 2026
5 checks passed
@andrew andrew deleted the fix-cross-device-rename branch April 6, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: os.Rename cause "invalid cross-device link" error when running in docker

1 participant