electron-builder: electron builder v26.0.0-alpha.2 fails to copy native deps with sym links
- Electron-Builder Version: 26.0.0-alpha.2
- Node Version: 20.17.0
- Electron Version: 31.5.0
- Electron Type (current, beta, nightly):
- Target: macOS
Version 26.0.0-alpha.2 introduces an issue when copying native deps that contain sym links, e.g.
⨯ Cannot cleanup:
Error #1 --------------------------------------------------------------------------------
Error: EISDIR: illegal operation on a directory, copyfile '/Users/<project folder omitted>/node_modules/<private native dep name omitted>/lib/Release/QtCore.framework/Versions/Current' -> '/private/var/folders/d2/svj1s5gn6_v88skdzfjwdmbdmb7f47/T/t-SBUwbm/asar-app-0/node_modules/<private native dep name omitted>/lib/Release/QtCore.framework/Versions/A'
Error #2 --------------------------------------------------------------------------------
Error: EISDIR: illegal operation on a directory, copyfile '/Users/<project folder omitted>/node_modules/<private native dep name omitted>/lib/Release/QtCore.framework/Resources' -> '/private/var/folders/d2/svj1s5gn6_v88skdzfjwdmbdmb7f47/T/t-SBUwbm/asar-app-0/node_modules/<private native dep name omitted>/lib/Release/QtCore.framework/Versions/A/Resources'
Error #3 --------------------------------------------------------------------------------
Error: ENOTSUP: operation not supported on socket, copyfile '/Users/<project folder omitted>/node_modules/<private native dep name omitted>/lib/Release/QtNetwork.framework/Resources' -> '/private/var/folders/d2/svj1s5gn6_v88skdzfjwdmbdmb7f47/T/t-SBUwbm/asar-app-0/node_modules/<private native dep name omitted>/lib/Release/QtNetwork.framework/Versions/A/Resources' failedTask=build stackTrace=Error: Cannot cleanup:
(Apologies for not sharing the full paths, hiding private names.)
I tracked down the issue to https://github.com/electron-userland/electron-builder/pull/8570/files, specifically I think the change in copyFileOrData, and the replacement of fileCopier.copy with fs.copyFile.
As you can see from the log, the issue is when copying sym links (like we find in Mac frameworks).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24
Commits related to this issue
- fix: Respecting unpack configuration when considering symlinks within previously unpacked directories. This directly fixes unpacking static `.framework` modules on Mac, as otherwise codesigning will f... — committed to mmaietta/asar by mmaietta 2 years ago
- fix: Respect unpack minimatch for symlinks within previously unpacked directories (#341) * fix: Respecting unpack configuration when considering symlinks within previously unpacked directories. This ... — committed to electron/asar by mmaietta 2 years ago
- fix: update @electron/asar to 3.2.18 to resolve signing issue with framework symlinks (#8762) fixes: https://github.com/electron-userland/electron-builder/issues/8655 — committed to Zezo-Ai/electron-builder by mmaietta 2 years ago
I’ve fixed the unit test failures in the
electron/asarPR and have marked it ready for review by the Electron team. Not sure on ETA now, but will work to get this resolved as soon as possibleDeployed 26.0.0-alpha.9 that includes this fix
AFAICT links within asars can’t be absolute paths, otherwise it’ll fail during extraction.
@ivanggq can you please try out this
patch-package? If it works, I’ll push the patch upstream for review by the project’s maintainers. So far, it worked correctly in both my local test project, the sym-link-demo, and in the unit tests I’ve written for @electron/asar package@electron+asar+3.2.17.patchThank you for the detailed report! I’ll take a look at this asap
Hi @mmaietta , I tested our internal project with
v26.0.0-alpha.6. While it seems the original copying issue is solved, there is an issue later during code signing, seemingly caused by the Qt framework not copied correctly:The error (sanitized):
I inspected the folder in question and this is what I see:
As you can see some folders are missing compared to a previous version we used.
And after I wrote this, I tested with
26.0.0-alpha.1- it is working fine in this version. So it seems the issue introduced in 26.0.0-alpha.2 is still not fully fixed in 26.0.0-alpha.6.Hi, I actually managed to create a minimal repo reproducing the issue: sym-link-demo.zip
The project contains a stripped down native dep with a stripped down Qt framework that reproduces the issue.
To repro:
npm installnpm run packageThanks for being so responsive.
The native dependency in question is private company library. I tried hard to find a similar public dependency, but couldn’t… I can look more, but also I am happy to provide more logs (sanitized), test implementations, etc.
Edit: Not that there is much more in the logs other than what I shared above, only the call stack of the failure.