cvs commit: src/usr.bin/file magic.5

John-Mark Gurney gurney_j at resnet.uoregon.edu
Mon May 29 03:59:56 PDT 2006


Ruslan Ermilov wrote this message on Mon, May 29, 2006 at 13:21 +0300:
> On Sun, May 28, 2006 at 07:15:36AM +0000, John-Mark Gurney wrote:
> > jmg         2006-05-28 07:15:36 UTC
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     usr.bin/file         magic.5 
> >   Log:
> [...]
> >   compiling mgc on a big endian system (specificly tested sparc64) breaks,
> >   using one from a little endian system works
> >   
> >   Revision  Changes    Path
> >   1.24      +18 -0     src/usr.bin/file/magic.5
> > 
> I have another experience from cross-build research.  Namely,
> only a native endianness format of *.mgc file works.  Just
> confirmed this on a freshly installed 6.1-RELEASE:
> 
> : Script started on Mon May 29 13:01:57 2006
> : sun# uname -sm
> : FreeBSD sparc64
> : sun# file magic.mgc*
> : magic.mgc:  magic binary file for file(1) cmd (version 2) (big endian)
> : magic.mgc_: magic binary file for file(1) cmd (version 2) (little endian)
> : sun# file /bin/sh
> : /bin/sh: ELF 64-bit MSB executable, SPARC V9, version 1 (FreeBSD), dynamically linked (uses shared libs), stripped
> : sun# mv magic.mgc magic.mgc~
> : sun# mv magic.mgc_ magic.mgc
> : sun# file /bin/sh
> : /bin/sh: data, dynamically linked (uses shared libs), stripped
> : sun# file magic.mgc*
> : magic.mgc:  magic binary file for file(1) cmd (version 33554432) (big endian)
> : magic.mgc~: JPEG 2000 image
> : sun# exit
> : exit
> : 
> : Script done on Mon May 29 13:02:49 2006
> 
> I.e., using a LE magic.mgc gives bullshit on a BE system.  Can you
> please re-check?

This was w/ a -current system...

Hmm. this is wierd:
# cd /usr/share/misc
# uname -a
FreeBSD carbon.funkthat.com 7.0-CURRENT FreeBSD 7.0-CURRENT #27: Mon Apr 17 19:02:25 PDT 2006     jmg at carbon.funkthat.com:/usr/home/jmg/p4/world/src/sys/i386/compile/carbon  i386
# file -C -m magic
# file magic
magic: magic text file for file(1) cmd
# file /tmp/*.CRW
Segmentation fault (core dumped)

That last part was the wierd part...  and if I copied the magic.mgc
from my 5.4-R box, it worked fine w/ the same line to match the CRW...
(See below before you point out that above isn't a sparc64 box)

And the magic line is:
# tail -n 1 magic
0       string  II\x1a\x00      Canon RAW

If I remove that line, the compile works, and file returns data:
# file /tmp/*.CRW
/tmp/CRW_0171.CRW: data

Wow, I must of really been tired when I made that commit, now that I
think about it, I was testing i386 to i386.. so I'll drop the big
endian bit, but it is a bit worry some that -current's file is broken..

# ident magic
magic:
     $Id: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $

Add the above magic line to that file, and I get a seg fault...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the cvs-src mailing list