Skip to content

fix(ddev): silence permission-denied warnings when ddev runs from an unreadable cwd - #52

Merged
steffenmaechtel merged 3 commits into
masterfrom
feature/ddev-poweroff
Sep 1, 2026
Merged

fix(ddev): silence permission-denied warnings when ddev runs from an unreadable cwd#52
steffenmaechtel merged 3 commits into
masterfrom
feature/ddev-poweroff

Conversation

@steffenmaechtel

Copy link
Copy Markdown
Owner

Closes #51

What

  • bin/ddev-as-opencode probes the inherited cwd ([ -x . ]) and falls back
    to the opencode home with a one-line stderr note when sudo kept an
    unreadable cwd; it never aborts.
  • New docs section in docs/concepts/ddev-integration.md.
  • New design record docs/design/ddev-url-transports.md: the browser-command
    URL transport (describe -j since 0.0.26), the removed DDEV_DEBUG/FULLURL
    transport, deferred alternatives, and a source map into the pinned ddev
    v1.25.3 checkout for re-verification on ddev updates.

Why

ddev poweroff (and any registry-driven run like ddev stop <project>)
from a directory the opencode user cannot search — the developer's $HOME,
0750 on Ubuntu 24.04 — warned per project:

Failed to load compose project for down: validating …:
error in parsing "compose-spec.json": stat .: permission denied

Root cause: sudo keeps the caller's cwd, and ddev's compose loader resolves
its embedded schema against the process cwd (os.Getwd() -> stat(".")), which
fails with EACCES there. The stop itself always worked — noise, not breakage
(verified with real ddev 1.25.3: warning reproduced from an unreadable cwd,
clean run otherwise).

Commands that need the cwd (bare ddev start) fail in such a directory
either way — the note keeps that failure explainable.

Testing

  • Unit tests: tests/test-ddev-as-opencode.sh (static wiring + functional
    stub runs incl. the owner-bit-trick unreadable cwd).
  • e2e-ddev DD7 exercises the real transport (dev shell -> ddev() -> sudoers
    helper -> real ddev from the dev's 0750 home).

Design record for the browser-command URL transport (describe -j since
0.0.26): field mapping and launch-argument parity, the removed
DDEV_DEBUG/FULLURL transport, the deferred alternatives (upstream
launch --print-url PR ddev/ddev#8772, global host-command env), and a
source map into the pinned ddev v1.25.3 checkout for re-verification
on ddev updates.
…unreadable, fixes #51

`ddev poweroff` (and any registry-driven run like `ddev stop <project>`)
from a directory the opencode user cannot search — the developer's $HOME,
0750 on Ubuntu 24.04, being the natural one — warned per project:

  Failed to load compose project for down: validating …:
  error in parsing "compose-spec.json": stat .: permission denied

Root cause: sudo keeps the caller's cwd, and ddev's compose loader
resolves its embedded schema (relative resource name) against the process
cwd via os.Getwd() -> stat("."), which fails with EACCES there. The stop
itself always worked — noise, not breakage (verified with real ddev
1.25.3: warning reproduced from an unreadable cwd, clean run otherwise).

bin/ddev-as-opencode now probes the inherited cwd ([ -x . ]) and falls
back to the opencode home with a one-line stderr note; it never aborts.
Commands that need the cwd (bare ddev start) fail in such a directory
either way — the note keeps that failure explainable.

Unit tests (static wiring + functional stub runs incl. the
owner-bit-trick unreadable cwd), e2e-ddev DD7 checks through the real
transport (dev shell -> ddev() -> sudoers helper -> real ddev from the
dev's 0750 home), docs section in ddev-integration.md.

@steffenmaechtel steffenmaechtel left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@steffenmaechtel
steffenmaechtel merged commit a3bbd44 into master Sep 1, 2026
3 checks passed
@steffenmaechtel
steffenmaechtel deleted the feature/ddev-poweroff branch September 1, 2026 19:22
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.

ddev poweroff, "compose-spec.json": stat .: permission denied

1 participant