Skip to content

fix: preserve relative symlink targets - #1985

Merged
MarshallOfSound merged 2 commits into
mainfrom
fix/preserve-relative-symlink-targets
Nov 27, 2026
Merged

MarshallOfSound merged 2 commits into
mainfrom
fix/preserve-relative-symlink-targets

Conversation

@claude

@claude claude Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

Summarize your changes:

This re-lands #1964 by @pol-rivero unchanged as a signed commit, because the original commit was unsigned and the repo's signed-commits ruleset blocked merging. pol-rivero is credited as co-author on the commit. Supersedes #1964.


Generated by Claude Code

@claude
claude Bot requested a review from a team as a code owner November 27, 2026 18:06

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread src/platform.ts Resolved
Comment thread src/platform.ts Resolved
With verbatimSymlinks, fs.cp can create a relative link before its target
directory has been copied, so Node's Windows type autodetection falls back
to a file symlink that can't be traversed. On Windows, skip symlinks during
the copy and recreate them afterwards with the type of their source target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PiGRtAKZgL18Mqq9z6swuS

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I re-reviewed this after the follow-up commit and found no new bugs. A code owner should still look, because this changes how symlinks are copied when derefSymlinks: false, and the new Windows-only branch has no tests.

What was reviewed:

  • The win32 deferred-symlink path. The copy filter holds back links only after userFilter accepts them, so ignore/junk rules still apply. Each link is then recreated with a 'dir' or 'file' type, taken from a stat of the source link, which covers the earlier link-type concern. A dangling source link becomes a 'file' link.
  • The branch where the output dir is inside the app dir. It calls the same wrapped filter for each top-level entry, so links held back there are also recreated before the afterCopy hooks run.
  • Parent directories of held-back links already exist when they are recreated, because fs.cp creates each directory before copying what is inside it.
Extended reasoning...

The change is in App.copyTemplate() in src/platform.ts. It sets verbatimSymlinks when derefSymlinks is false, and on win32 it holds back symlinks during the copy and recreates each one afterwards with an explicit link type. test/packager.spec.ts adds two Linux-only tests. It touches no auth, injection or data-exposure code. The deciding facts are that a code owner team covers every file (.github/CODEOWNERS) and that the win32 branch is not tested in CI.

Still open from earlier reviews (1):

  • Unresolved: 1 minor or pre-existing.

@MarshallOfSound
MarshallOfSound merged commit 58238ab into main Nov 27, 2026
10 checks passed
@MarshallOfSound
MarshallOfSound deleted the fix/preserve-relative-symlink-targets branch November 27, 2026 20:16
@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 20.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants