-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
[apple-codesign] Error: binary parsing error: Invalid magic number: on Linux #10
Comments
The two problems are likely connected as we seem to be confusing a jar file with a mach-o binary. If you look at the source code for the So, this comment turned out to likely be accurate. I'll need to teach the code how to handle non Mach-O binaries in nested bundle directories. That entails running Apple's official tooling and looking at their output to see how they handle the files. I should probably be able to figure this out without steps to reproduce. But if you are able to sign your bundle with Apple's |
OK, I think I got it working somehow. It seems that my bundle layout was not up to code sign standards. I had entire Java app, including all jars and JRE in
It looks like With this approach, Another thing I noticed is that there was a panic at the end of the log output:
So, I'm not sure if the signing was complete. |
I'm relieved that Apple's official tooling rejected the non-Mach-O binaries! But we should fix Regarding symlinks, we should handle those fine. However, they have historically caused complexities. It is possible you found an edge case. If you attempt to sign a bundle in-place, I could easily see how that might not work with symlinks. Did you try passing multiple arguments to That being said, the diff might indicate a separate bug where we just don't handle symlinks correctly for some sub-directories. I'll need to reproduce to get to the bottom of it. I think I have enough context in this issue to do that. Thanks again for the detailed info! |
I tried with different output directory, but still getting the same result. Symlinks do not get included. I've tried running app bundle signed on Linux on Mac, and it didn't complain. So, I suppose signing is valid. The only issue I might see here is:
I'm not sure if this is enough to guarantee that it works OK, but I hope it is. Another thing I ran into: I run the signing with command like this:
And I get this error:
This happens for both in-place and external signing. The solution I came up with is to add
I suppose this is realted to CLI arguments handling, but I encountered it during signing process. Should I create a separate issue for it? |
I am encountering a similar issue with symlinks not being included in
From the output of
Looking at
The comment believes that these symlinks are part of a nested bundle, which is not the case. They are part of the main bundle. So we need to call |
The invalid magic number issue is likely fixed by 1c63bca. I also just rewrote the bundle signing logic in b26376f to hopefully better match Apple's tooling. I'm going to add a test for behavior of symlinks in a nested directory (like |
I think this is fixed in |
I'm testing
apple-codesign
on Linux, and encountered this error immediately:I have an app bundle which contains Java application with JRE, native launcher and a bunch of jar files. So, I run the command:
Relevant log output:
So, it seems rcodesign is trying to sign a jar file and fails with this magic number error. Running hexdump on that jar gives the following output:
The first two bytes look like they are in inverted order to what is reported by rcodesign. So, is it possible that this is some kind of endian-ness problem?
Any idea of what might be the problem?
In addition, when I try to sign only the native launcher, I get the following error:
Not sure if the two problems are connected.
The text was updated successfully, but these errors were encountered: