-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Respect unpack minimatch for symlinks within previously unpacked directories #341
base: main
Are you sure you want to change the base?
Conversation
… previously unpacked directories. This directly fixes unpacking static `.framework` modules on Mac, as otherwise codesigning will fail due to symlink files/directories not being reflected in the app.asar.unpacked directory. Added unit test with Hello.framework, generated from tutorial https://jano.dev/apple/mach-o/2024/06/28/Hello-Static-Framework.html Fixes: electron-userland/electron-builder#8655
prettier
change readlinkSync to realpathSync for windows OS
…mmaietta/asar into fix/static-framework-symlinks-2
b98871b
to
888ef4f
Compare
const link = await fs.readlink(file.filename); | ||
await fs.symlink(link, path.join(`${dest}.unpacked`, filename)).catch(async (error) => { | ||
if (error.code === 'EPERM' && error.syscall === 'symlink') { | ||
throw new Error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows, using junction to create symlinks should avoid permission issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great callout. I read somewhere (can't find the link atm) that junctions are absolute links, as opposed to a "pointer" relative path. If so, we don't want absolute links between folders in the unpacked folder, otherwise I don't think the asar will work on other computers.
Summary:
Fixes issue with unpack configuration when considering symlinks within previously unpacked directories. This directly fixes unpacking static
.framework
modules on Mac, as otherwise codesigning will fail due to symlink files/directories not being reflected in the app.asar.unpacked directory.Fix:
unpacked
flag asnode.unpacked=true
symlink
andreadlink
Hello.framework
for mac/linux symlink verification (ln -s
)WindowsMklink
dir for validating windows symlink (mklink
)Added unit test with Hello.framework, generated from HelloWorld tutorial https://jano.dev/apple/mach-o/2024/06/28/Hello-Static-Framework.html
Details:
.framework
has to have all symlinks reproduced in the unpacked directory for signing. The top is with electron/asar unpacked folder, the bottom is the actual framework contents.Without this PR, codesigning will fail with
QtCore.framework: bundle format unrecognized, invalid, or unsuitable
Fixes: electron-userland/electron-builder#8655 (comment)