You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an angular app that i add as "extraResources" with electron builder to the electron app.
There are many files in there, because i have a custom pdfjs version with all its files, e.g. many many cmaps.
Since osx-sign is going through all folder and files inside "Content" it reaches some limits and dies.
a little reproduction repo: https://github.com/fdk-app/electron-osx-sign-invalid-size-error
its just an empty electron-vite project + the www-folder as extra resources. I added there only the assets of a library we use, which are more or less pdfjs, but i added the cmaps folder multiple times.
Signing dies directly after it starts - check the build github action at the repo.
remove some "cmaps" folders and it works.
The problem i see here is, that even i worked around in our production app for now, we will reach that point again because our angular app will grow as well.
Just a guess maybe it is that "isBinaryFile" check which is leading to that problem. it uses Buffer.alloc which allocs new space foreach file and since the walkfiles is running recursive and in parallel for each files it will easy explode.
BTW: this isBinaryFile library is running "stat" again.
A possible solution, but maybe breaks some other really really edge cases (some unknown file extensions/custom extensions or false/no extension) is to use some not that strict checks...
Or do not everything in parallel/run in batches this will slow down the signing a little bit, but maybe the garbage collector has the chance to clean things up in between.
Or batch and use isBinaryFile but pass the buffer on your own, so no additional stat call is done
The text was updated successfully, but these errors were encountered:
I created an issue at electron-builder, but i debugged and invested time to nail it down and it seems it is an osx-sign issue:
Check:
electron-userland/electron-builder#8306
Long story short:
I have an angular app that i add as "extraResources" with electron builder to the electron app.
There are many files in there, because i have a custom pdfjs version with all its files, e.g. many many cmaps.
Since osx-sign is going through all folder and files inside "Content" it reaches some limits and dies.
a little reproduction repo: https://github.com/fdk-app/electron-osx-sign-invalid-size-error
its just an empty electron-vite project + the www-folder as extra resources. I added there only the assets of a library we use, which are more or less pdfjs, but i added the cmaps folder multiple times.
Signing dies directly after it starts - check the build github action at the repo.
remove some "cmaps" folders and it works.
The problem i see here is, that even i worked around in our production app for now, we will reach that point again because our angular app will grow as well.
Just a guess maybe it is that "isBinaryFile" check which is leading to that problem. it uses Buffer.alloc which allocs new space foreach file and since the walkfiles is running recursive and in parallel for each files it will easy explode.
https://github.com/electron/osx-sign/blob/main/src/util.ts#L153
BTW: this isBinaryFile library is running "stat" again.
A possible solution, but maybe breaks some other really really edge cases (some unknown file extensions/custom extensions or false/no extension) is to use some not that strict checks...
like just test file extensions:
https://github.com/sindresorhus/is-binary-path
Or do not everything in parallel/run in batches this will slow down the signing a little bit, but maybe the garbage collector has the chance to clean things up in between.
Or batch and use isBinaryFile but pass the buffer on your own, so no additional stat call is done
The text was updated successfully, but these errors were encountered: