Subject: bin/1910: /etc/magic changes for SGI MIPSLE-LE ECOFF inconsistent with Ultrix
To: None <>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 01/07/1996 08:20:47
>Number:         1910
>Category:       bin
>Synopsis:       magdir/sgi changes for SGI/mips wrong for pmax LE mips
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan  7 11:50:13 1996
>Originator:     Jonathan Stone
	stanford dsg
>Release:        NetBSD-current at 1995-12-22
System: NetBSD Reno.DSG.Stanford.EDU 1.1A NetBSD 1.1A (NEWCONF) #20: Sun Jan 7 05:21:40 PST 1996 jonathan@Reno.DSG.Stanford.EDU:/usr/src/sys/arch/pmax/compile/NEWCONF pmax


NetBSD's pmax port runs on a little-endian MIPS machine (Decstations).
The NetBSD /usr/bin/file  command used to correctly identify such
binaries as being Ultrix/pmax ECOFF binaries.

It appears that someone incorporated file-1.37.

This version of file  has support for  SGI (big-endian mips) magic numbers.
Supporting SGI magic numbers is laudable.  However, whoever wrote this
(presumably for file-1.3&) apparently didn't realize that those magic
numbers are inappropriate (or wrong) for little-endian MIPS machines.
Indeed, the comments in magdir/sgi say as much: it's correct for
SGI's big-endian product line.

On NetBSD/pmax, identification of Ultrix/mips (little-endian files),
which now appear as being

	MIPSEL-LE COFF executable (paged) stripped - version 10.2

which is bogus in several ways:

1. The name is wrong. These are ECOFF binaries, not COFF.
   (that applies to the other mips COFF binaries, too.)

2. The name MIPSEL-LE is bogus, or at least big-endian
   biased. The corresponding name in /etc/magic for big-endian
   header, big-endian content ECOFF binaries is "MIPSEB".
   The appropriate name for little-endian-header, little-endian
   content mips/ecoff files should be "MIPSEL", not "MIPSEL-LE".
   HOwever, the /etc/magic entry uses "MIPSEL" to mean big-endian
   header, little-endian content.

   Surely, if native big-endian ECOFF mips files are "MIPSEB",,
   native little-endian ECOFF mips files should be "MIPSEL".

3. The version number for native-little-endian ecoff appears
   byte-swapped; it should be 2.10, not 10.2.


	/usr/bin/file any-ultrix/RISC-pmax-binary.

The comment in /etc/magic saying  changes need to be
made to src/cmd/file/magdir should be altered for NetBSD, where
the source is in /usr/src/bin/file/magdir.

The following should be submitted to the maintainers of file:

Rename magdir/sgi to magdir/mips, since SGI is not the only vendor
of MIPS chips.

Change all occurences of COFF to ECOFF in magdir/mips.
Change all occurences of "MIPSEL" to "MIPSEL-BE" in magdir/mips.
(It's not clear to me that "MIPSEB-LE" and "MIPSEL-BE" are the
 right way around.)

Change all occurences of "MIPSEL-LE" to "MIPSEL" in magdir/mips.