Skip to content

Fix | copyDir follows directory symlinks instead of failing with EISDIR#449

Merged
dag-andersen merged 1 commit into
dag-andersen:mainfrom
tobrien-nydig:fix/copydir-directory-symlinks
Jun 20, 2026
Merged

Fix | copyDir follows directory symlinks instead of failing with EISDIR#449
dag-andersen merged 1 commit into
dag-andersen:mainfrom
tobrien-nydig:fix/copydir-directory-symlinks

Conversation

@tobrien-nydig

Copy link
Copy Markdown
Contributor

Fixes #448.

Problem

Rendering a same-repo source whose local Helm chart contains a symlink to a directory aborts the whole run:

failed to copy content source dir "target-branch/helm_charts/<chart>": ... files/sql: copy_file_range: is a directory
❌ Failed to extract resources

copyDir walks with filepath.Walk (which Lstats), so a directory symlink reports info.IsDir() == false and is handed to copyFile; os.Open follows the link to the directory and io.Copy fails with EISDIR. Charts commonly vendor assets via directory symlinks (e.g. files/sql -> ../../sql), so this trips repo-server-api renders of same-repo path: sources.

Fix

Resolve symlinks in copyDir: when one targets a directory, recurse into the resolved path so its contents are materialized at the destination — matching how Argo CD's repo-server reads a chart on disk. File symlinks are unchanged (copyFile already follows them).

Test

Adds TestCopyDir_FollowsDirectorySymlink, which fails on main with the EISDIR error and passes with the fix. Full pkg/reposerverextract suite passes; go vet and gofmt clean.

When a local content-source directory (a Helm chart streamed for a
same-repo source) contains a symlink to a directory, copyDir passed the
link to copyFile. filepath.Walk reports the link via Lstat, so
info.IsDir() is false; copyFile then os.Open()s the link, follows it to
the target directory, and io.Copy() fails with EISDIR -- surfaced as
'failed to copy content source dir ...: ... is a directory' (Linux:
copy_file_range). The whole render then aborts with 'Failed to extract
resources'.

Resolve symlinks in copyDir: when one targets a directory, recurse into
the resolved path so its contents are materialized at the destination,
matching how Argo CD's repo-server reads a chart's on-disk content. File
symlinks are unchanged (copyFile already follows them). Common in charts
that vendor assets via directory symlinks, e.g. files/sql -> ../../sql.
@dag-andersen dag-andersen merged commit 4b831ad into dag-andersen:main Jun 20, 2026
3 checks passed
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.

Render aborts (EISDIR) when a same-repo Helm chart contains a directory symlink

2 participants