Maintainer of /etc/magic?

Maintainer of /etc/magic?

Post by Michael Elizabeth Chasta » Tue, 28 Nov 1995 04:00:00



I'm looking for the keeper of the '/etc/magic' file.

I want a magic number for my data file format.  Right now, I'm just
making them up: 0x0100FACE, 0x0200FACE, and so on.  It would be nice to
get them into /etc/magic and to make sure they don't collide with any
other numbers.

Michael Chastain

Check out my fledgeling trace-and-replay de*:
ftp://tsx-11.mit.edu/pub/linux/sources/usr.bin/mec-0.3.tar.gz

 
 
 

Maintainer of /etc/magic?

Post by Daniel Quinl » Wed, 29 Nov 1995 04:00:00



Quote:> I'm looking for the keeper of the '/etc/magic' file.
> I want a magic number for my data file format.  Right now, I'm just
> making them up: 0x0100FACE, 0x0200FACE, and so on.  It would be nice
> to get them into /etc/magic and to make sure they don't collide with
> any other numbers.


implementation that Linux uses.

My best advice in choosing a magic number for any new file format is:

 - don't pick anything that collides with other numbers (on both
   little-endian and big-endian machines).  Check all types - strings,
   octal, hexadecimal, decimal, etc.
 - try to use the same magic for both little-endian and big-endian
   machines, use a separate flag for byte-order if necessary
 - use the same magic for different versions of your file format, use
   a separate field for the version number.  (This keeps the namespace
   as free as possible.)
 - use at least a 4 byte long magic number (a long), not any shorter.
 - test your file to see if it gives any false matches with the
   current (minus your magic) /etc/magic.
 - test your magic (in /etc/magic format) to see if it matches any
   files (minus files in your format) on several different operating
   systems.
 - try to use a mix of printable and non-printable characters in the
   magic in order to avoid matching text files.
 - try to avoid multiple null characters in the magic.

file is available at: file://ftp.deshaw.com/pub/file

Dan
--
Daniel Quinlan          Member of the League for Programming Freedom


 
 
 

1. magic numbers, /etc/magic and the Real World(tm)

Hi,

        As an idle programming exercise I have been perusing the
contents of .o files (partly to see why C++ gobbles so much space, but
that's another matter).  Flushed with success I thought it would be
neat to rummage around libraries as well since they're just a whole
bunch of .o's with some `other' info.

        The problem then arose, how do I tell the difference between
files, ie given that I'm a good boy and parse /etc/magic... but wait!
What am I looking for in /etc/magic?  Rather than hardcode a magic
number, I am obliged to hardcode some arbitrary string to look for in
/etc/magic to identify my magic number but who's to say that that
string is the same in your /etc/magic?  And round we go again.

        Is there a sensible solution?

--
Cheers,

        Ian

-------------------------------------------------------------------------------

   Fulcrum Communications ltd., Fordrough Lane, Birmingham, B9 5LD

2. Booting Linux

3. good /etc/magic source.

4. Apache and HTTPS

5. /etc/magic for XWD

6. XF86 3.1 X-config for Viper

7. Help setting up the etc/MAGIC file

8. Commercial:Linux Products From Universal CD-ROM(4/98)

9. /etc/magic

10. /etc/magic entry for GIFs

11. Where can I get /etc/magic?

12. Additions to /etc/magic, file types

13. reading /etc/magic ...