Repository navigation
fix: preserve relative symlink targets - #1985
Conversation
Co-authored-by: Pol Rivero <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PiGRtAKZgL18Mqq9z6swuS
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
There was a problem hiding this comment.
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
userFilteraccepts 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.
|
🎉 This PR is included in version 20.3.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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