Subject: Re: /usr/share differs between archs
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 05/13/2003 11:54:32
In article <3EC0499E.7010006@gmx.de>, Nino Dehne <TeCeEm@gmx.de> wrote:
>Hi,
>
>replying to my own message
>
>> I was told that *.mgc files are really just "memory dumps" of tables to
>> avoid re-parsing of the associated plain text files at each invocation.
>> Are these a problem for a shared /usr/share with both 32bit and 64bit
>> machines? I could just go ahead and try it but I think it's better to
>> stay theoretical as sometimes there's more than "oh, it obviously works".
>
>I _did_ try it and can say "oh, it obviously _doesn't_ work":
>
>    alpha$ file /bin/*
>    /bin/[:          file: invalid type 0 in mconvert().
>
>Clearly, this is faulty. I worked around the problem by moving the *.mgc 
>files out of place.
>
>    alpha$ file /bin/*
>    file: Using regular magic file `/usr/share/misc/magic'
>    /bin/[:          ELF 64-bit LSB executable, Alpha (unofficial), [...]
>    [...]
>
>I expected the parsing to take extraordinarily long but it was bearable 
>given the usual feeling of an AXPpci33 21066/166 with nfs-root over 10Mb/s.
>
>Now I'm struggling as to what is the "cleaner" approach: a) move such 
>arch-dependent files out of the arch-independent tree b) don't use them 
>at all and trade speed for interoperability/disk space.
>
>What's a clean solution to this?

I think the version of file in the tree has a small bug right now.

Try this patch:

Index: file.h
===================================================================
RCS file: /src/pub/file/src/file.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- file.h	28 Mar 2003 21:02:03 -0000	1.53
+++ file.h	4 Apr 2003 21:59:27 -0000	1.54
@@ -114,7 +114,7 @@
 	uint8_t mask_op;	/* operator for mask */
 	uint8_t dummy1;	
 	uint8_t dummy2;	
-#define				FILE_OPS	"&|^+-*%/"
+#define				FILE_OPS	"&|^+-*/%"
 #define				FILE_OPAND	0
 #define				FILE_OPOR	1
 #define				FILE_OPXOR	2