allbery@ncoast.UUCP (Brandon Allbery) (12/10/85)
Expires: Quoted from <3061@sun.uucp> ["Re: Magic Numbers (and incredible stupidity in "cpio")"], by guy@sun.uucp (Guy Harris)... +--------------- | > Executables using ``standard'' binary formats, i.e. a.out (PDP-11, Z8000) | > and b.out (MC68000) use the standard magic numbers 0405, 0407, 0410, 0411. | > Non-standard formats, like Xenix x.out (0x0206) and COFF (flames to | > /dev/null; most systems are [ab].out) use distinctive magic numbers. | | Well, VAX UNIX (32V, 4.xBSD, System III, Version 8?) also uses those magic | numbers (with 413 added for demand paged executables on 4.xBSD), and | probably lots of other 4.xBSD systems (Sun's does). Does "most" mean "most | UNIX implementations" or "most boxes running UNIX"? +--------------- Most UN*X implementations. . . By ``distinctive'', I meant that the magic numbers are a dead giveaway of the OS; an executable beginning with 0x0206 is *always* for Xenix, while 0407 could be *any* version of ``standard'' Un*x. +--------------- | COFF seems to invert this, since the "file header" indicates what machine | it's intended for. . . and the "UNIX header" has the 0405, 0407, 0410, 0411, | and 0413. . . which indicates the format of the image but is machine- | independent (modulo byte ordering). Then again, the "file header" magic | number seems to indicate something about the format of the executable.... +--------------- Even worse than I thought. Xenix headers were the most portable ones I've ever heard of or seen; I wish everyone would use x.out. . . +--------------- | > .......... System V archives begin with the magic ``number'' "!<arch>\n". | | System V, Release 2 archives, anyway; System V Release 1 had a portable | archive format which was different from the 4.xBSD one which was the first | one to use the "!<arch>\n" magic "number". +--------------- Figures. But I have no experience with V.1; we're upgrading from sys3 to V.2.2 (and I can't wait to bring up Gnu Emacs! :-)). +--------------- | > Cpio archives also have magic numbers in them, but at the archive-member | > level. | | No, it has a magic number at the beginning - 070707.... +--------------- Hmmm. . . the Plexus manual shot down in flames again. Thanks; I can at least correct cpio(5). +--------------- | ... "gee, we've finally caught up with 'tar' when it comes to portability" | "cpio -c" archive. +--------------- Bah. For compatibility we use dd conv=swap < /dev/rmt0 | tar xvf - anyway. Although I may use ansitar instead (if I can get around it backspacing on raw magtape, which the P/60 can't do). +--------------- | (Flame off, until next time a collection of stupidities this gross comes to | light.) | | Guy Harris +--------------- ``It won't be long now. . .'' :-) --Brandon -- Lord Charteris (thurb) ncoast!allbery@Case.CSNet (ncoast!allbery%Case.CSNet@CSNet-Relay.ARPA) ..decvax!cwruecmp!ncoast!allbery (..ncoast!tdi2!root for business) 6615 Center St., Mentor, OH 44060 (I moved) --Phone: +01 216 974 9210 CIS 74106,1032 -- MCI MAIL BALLBERY (WARNING: I am only a part-time denizen...)