Skip to content

Hotfix 1.2.5: fix app:apikeys:add on bind-mounted .env.local - #67

Merged
turegjorup merged 3 commits into
mainfrom
hotfix/1.2.5
Oct 7, 2026
Merged

turegjorup merged 3 commits into
mainfrom
hotfix/1.2.5

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Hotfix 1.2.5: make app:apikeys:add work on prod, where .env.local is a single-file bind mount.

Changes

  • Replace the final rename(.env.local.temp, .env.local) with an in-place write (copy()), followed by a read-back check. If the write fails or the content doesn't match, .env.local is restored from .env.local.backup (or removed if it didn't exist before) and the command fails.
  • Drop the chmod() on the temp file: writing in place keeps the file's owner and mode.
  • The test now asserts .env.local keeps its inode, so a return to rename() fails the suite.

Why

docker-compose.server.prod.yml mounts ../../shared/.env.local:/app/.env.local. That makes .env.local a mount point inside the container, and rename() can't replace it:

rename(/app/.env.local.temp,/app/.env.local): Device or resource busy

Reproduced with itkdev/php8.4-fpm and the same mount layout. With the fix, bin/console app:apikeys:add prod_test -n updates the host-side shared file and leaves no temp or backup behind.

Trade-off: the write is no longer atomic, so a request that reads .env.local mid-write could briefly see a partial file. The backup and read-back check still prevent losing keys.

@turegjorup turegjorup self-assigned this Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

✅ No changes detected in API specification

@turegjorup
turegjorup merged commit 7253940 into main Oct 7, 2026
12 checks passed
@turegjorup
turegjorup deleted the hotfix/1.2.5 branch October 7, 2026 09:20
This was referenced Oct 7, 2026
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.

1 participant