🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #443

Re: Improving "file" (was Re: Making Solaris 2.1 smarter...)

#443
From: Guy Harris
Date: Tue, 12 Jan 1993 18:36
47 lines
2489 bytes
>(guy) requires a-priori partitioning of file formats into
>big and little endian classes -- the problem here is that
>there are some formats that are architecture independent
>but still byte order dependent, like the binary cpio format
>the solution is to provide duplicate magic file entries:
>
>0	short		070707		cpio archive
>0	short		0143561		cpio archive

Nope.  Try:

0	short		070707		cpio archive
0	short		0143561		byte-swapped cpio archive

Given that, unfortunately, not all versions of "cpio" are capable of
decoding binary "cpio" files with the opposite byte order, it is
potentially useful to know whether the archive is byte-swapped or not.

>(gsf) is based on the assumtion that a byte swapped binary magic number
>will not clash with other magic file magic numbers (not a problem so far)

Actually, I think the old Sun-2 executable format *does* clash with the
VAX BSD executable format - one has 4 bytes of 0407/0410/0413 in
big-endian order at the beginning, the other has them in little-endian
order at the beginning.

>this method avoids most magic file duplication for formats that cannot
>be a-priori labeled BE or LE -- it also handles byte orderings other
>then BE and LE (pdp shorts were LE but longs were half LE half BE)

Mine handles that as well, although you would have to use "belong" or
"lelong" with a constant the two halves of which are swapped.

>you must provide a duplicate entry for binary cpio, no?

Nope.  See above.

>what about cpu's with byte swap HW jumpers -- does the format change
>or just the byte order (not a trick question, I really don't know about
>this)

It appears, from some of the magic file entries, that the magic number
changes on at least one MIPS object/executable format.

Besides, I, at least, would want to know whether something is a
big-endian or little-endian Frobozz executable, not just whether it's a
Frobozz executable or not....
Technical Details
Message-ID: <16356@auspex-gw.auspex.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!auspex-gw!guy
References: <16320@auspex-gw.auspex.com> <1993Jan10.143907.12860@ulysses.att.com> <16329@auspex-gw.auspex.com> <1993Jan11.183955.17911@ulysses.att.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!auspex-gw!guy
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.bugs.sys5
Subject: Re: Improving "file" (was Re: Making Solaris 2.1 smarter...)
Message-ID: <16356@auspex-gw.auspex.com>
Date: 12 Jan 93 18:36:08 GMT
References: <16320@auspex-gw.auspex.com> <1993Jan10.143907.12860@ulysses.att.com> <16329@auspex-gw.auspex.com> <1993Jan11.183955.17911@ulysses.att.com>
Sender: news@auspex-gw.auspex.com
Distribution: na
Organization: Auspex Systems, Santa Clara
Lines: 47
Nntp-Posting-Host: bootme.auspex.com