---
jtool return 0 (Success) if no architecture was provided and no useful information is output.
- Code: Select all
$ jtool -h /Applications/Caffeine.app/Contents/MacOS/Caffeine
Fat binary, big-endian, 4 architectures: i386, ppc7400, ppc64, x86_64
Specify one of these architectures with -arch switch, or export the ARCH environment variable
$ echo $?
0
Would it be possible to return a different return code here? While no error per se occurred, the result is not what one would expect and can not directly be distinguished from a useful result (useful as if a valid architecture had been provided).
---
Jtool reports success if the requested architecture could not be found in the input file
- Code: Select all
# Caffeine.thinner obtained using lipo command
$ jtool -h Caffeine.thinner
Fat binary, big-endian, 3 architectures: i386, ppc7400, ppc64
Specify one of these architectures with -arch switch, or export the ARCH environment variable
# First issue, imho this should not return 0
$ echo $?
0
# This works
$ jtool -h -arch i386 Caffeine.thinner
Magic: 32-bit Mach-O
Type: executable
CPU: i386
Cmds: 19
Size: 2756 bytes
Flags: 0x85
# This should not return 0 imho
$ jtool -h -arch x86_64 Caffeine.thinner
Requested architecture not found in file
$ echo $?
0
Similar to the first issue mentioned, scriptability of jtool could be improved by returning a non-zero return code here. Supplying an architecture that is not contained in the file is clearly an error (and, through the ARCH environment variable, it is quite easy to hit this edge case!)
It would also be awesome to be able to supply a list of architectures to consider via the ARCH environment variable:
Say I specify
- Code: Select all
export ARCH="x86_64 i386"
jtool -h /path/to/bin
jtool could then treat the ARCH environment variable as a list of my preferences: If available, return results for the x86_64 slice. If not, fall back to the i386 slice. If that is also not available, display an error message (and hopefully do not return 0

---
The
- Code: Select all
-arch
- Code: Select all
$ jtool -h /Applications/Caffeine.app/Contents/MacOS/Caffeine
Fat binary, big-endian, 4 architectures: i386, ppc7400, ppc64, x86_64
Specify one of these architectures with -arch switch, or export the ARCH environment variable
$ jtool -arch ppc64 -h /Applications/Caffeine.app/Contents/MacOS/Caffeine
Unrecognized architecture: ppc64
$ jtool -arch ppc7400 -h /Applications/Caffeine.app/Contents/MacOS/Caffeine
Unrecognized architecture: ppc7400
$ echo $?
2
Even if jtool does not support ppc, then the documentation should be updated to reflect that the user cannot specify any one of these architectures.
Note that this is also applies to jtool2.