[File] [E] Re: How to detect go mac executables with magic.h?
Guy Harris
gharris at sonic.net
Wed May 26 00:00:19 UTC 2021
On May 25, 2021, at 3:25 PM, Matthew Czarnek <matthew.czarnek at verizonmedia.com> wrote:
> I'm using version 5.11-37.el7 of file, the latest version.
And, on my Ubuntu 20.04 VM, I'm using the version bundled with the distribution:
ubu20-04$ file --version
file-5.38
> For the mac executable on Linux:
>
> "file magic8" correctly shows:
> magic8: Mach-O 64-bit executable
ubu20-04$ scp {the Mac host}:/bin/cat /tmp
Password:
cat 100% 119KB 17.4MB/s 00:00
ubu20-04$ file /tmp/cat
/tmp/cat: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>] [arm64:Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>]
> But "file -i magic8", which I believe uses the magic.h header shows:
> magic8: application/octet-stream; charset=binary
ubu20-04$ file --mime-type /tmp/cat
/tmp/cat: application/x-mach-binary
magic file from /etc/magic:/usr/share/misc/magic
ubu20-04$ file -i --mime-type /tmp/cat
/tmp/cat: application/x-mach-binary; charset=binary
ubu20-04$ file -i /tmp/cat
/tmp/cat: application/x-mach-binary; charset=binary
Maybe you just need a newer version of the file code, i.e. build from the latest source rather than using whatever your distribution provides.
More information about the File
mailing list