Skip to content

fix(filemerge): follow symlinked parent directories instead of refusing#734

Open
facchin21 wants to merge 1 commit into
Gentleman-Programming:mainfrom
facchin21:fix/filemerge-symlink-parent-dir
Open

fix(filemerge): follow symlinked parent directories instead of refusing#734
facchin21 wants to merge 1 commit into
Gentleman-Programming:mainfrom
facchin21:fix/filemerge-symlink-parent-dir

Conversation

@facchin21

Copy link
Copy Markdown

Summary

  • ensureAtomicParentDir previously returned an error when the parent directory was a symlink, blocking installations for users whose Claude Code config subdirectories (e.g. ~/.claude/agents) are managed as symlinks to a dotfiles or team config repository
  • Fix: when a symlink is detected, resolve it with filepath.EvalSymlinks, stat the real target, and continue the existing directory and permission checks against the resolved path
  • The write itself proceeds through the symlink transparently (OS-native behavior); no security regression — the resolved target is still verified to be a writable directory

Test plan

  • go test ./internal/components/filemerge/... passes
  • go test ./... passes
  • Run gga with ~/.claude/agents symlinked to a real directory: component:sdd installs successfully

Closes #733

When a parent directory in the write path is a symlink (e.g. ~/.claude/agents
pointing to a dotfiles repo), resolve it with filepath.EvalSymlinks and
continue checks against the real target directory.

Previously, any symlinked parent caused an unconditional refusal, breaking
installations for users who manage their Claude Code config via symlinks.
@Alan-TheGentleman Alan-TheGentleman added the type:bug Bug fix label Jun 17, 2026

@Alan-TheGentleman Alan-TheGentleman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Scoped, tested, linked to the approved issue. The symlink boundary stays safe because parent symlinks are resolved while final-file symlink rejection remains intact. Approving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(filemerge): allow writing through symlinked parent directories

2 participants