View Issue Details

IDProjectCategoryView StatusLast Update
0000045file[All Projects] Generalpublic2018-10-01 23:34
ReportersezeroAssigned Tochristos 
Status resolvedResolutionfixed 
Product Version5.34 
Target VersionFixed in Version5.35 
Summary0000045: unreadable output for macho fat files
Description$ file --version
magic file from /home/sezero/opt/file-5.34/share/misc/magic
$ file wildmidi
wildmidi: Mach-O universal binary with 3 architectures: [x86_64:Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL>] [ppc:Mach-O ppc executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL>]

This is a fat file with x86_64, i386 and ppc architectures. While
trying to output flags (useless IMHO, but it's just me), file loses
one of the arches (i386) and the output is pretty much unreadable.

As far as I can tell, this behavior began with file-5.27 (file-5.26
doesn't compile for me.) With file-5.25, the output was readable,
although it did lose the last arch, i.e. ppc:
wildmidi: Mach-O universal binary with 3 architectures: [x86_64: Mach-O 64-bit x86_64 executable] [i386: Mach-O i386 executable] []
TagsNo tags attached.



2018-10-01 19:02

manager   ~0000078

Do you have a binary that reproduces this?
I get:
./file -m ../magic/magic.mgc /bin/sync
/bin/sync: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>] [i386:Mach-O i386 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE|NO_HEAP_EXECUTION>]


2018-10-01 19:03

manager   ~0000079

waiting for example.


2018-10-01 19:22

reporter   ~0000084

The tarball here has the file I referred to in the original report:

Also attaching one of the files from that tarball here.

wildmidi (73,772 bytes)
wildmidi (73,772 bytes)


2018-10-01 20:43

manager   ~0000088

Hmm, something is fishy with that file: Apple's file binary finds 3 architectures, but only in the body, not in the headers:
$ file wildmidi
wildmidi: Mach-O universal binary with 3 architectures: [x86_64:Mach-O 64-bit executable x86_64] [ppc:Mach-O executable ppc]
wildmidi (for architecture x86_64): Mach-O 64-bit executable x86_64
wildmidi (for architecture i386): Mach-O executable i386
wildmidi (for architecture ppc): Mach-O executable ppc

Will look into it some more.


2018-10-01 21:11

reporter   ~0000089

lipo (from cctools-port) three arches in header:

$ /opt/cctools-port/bin/i686-apple-darwin9-lipo -detailed_info wildmidi
Fat header in: wildmidi
fat_magic 0xcafebabe
nfat_arch 3
architecture x86_64
    cputype CPU_TYPE_X86_64
    cpusubtype CPU_SUBTYPE_X86_64_ALL
    offset 4096
    size 19832
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 24576
    size 23976
    align 2^12 (4096)
architecture ppc
    cputype CPU_TYPE_POWERPC
    offset 49152
    size 24620
    align 2^12 (4096)


2018-10-01 23:34

manager   ~0000090

Fixed to print the missing arch, thanks!

Issue History

Date Modified Username Field Change
2018-09-17 07:54 sezero New Issue
2018-10-01 19:02 christos Note Added: 0000078
2018-10-01 19:02 christos Assigned To => christos
2018-10-01 19:02 christos Status new => assigned
2018-10-01 19:03 christos Status assigned => feedback
2018-10-01 19:03 christos Note Added: 0000079
2018-10-01 19:22 sezero File Added: wildmidi
2018-10-01 19:22 sezero Note Added: 0000084
2018-10-01 19:22 sezero Status feedback => assigned
2018-10-01 20:43 christos Note Added: 0000088
2018-10-01 21:11 sezero Note Added: 0000089
2018-10-01 23:34 christos Status assigned => resolved
2018-10-01 23:34 christos Resolution open => fixed
2018-10-01 23:34 christos Fixed in Version => 5.35
2018-10-01 23:34 christos Note Added: 0000090