emp_server and empdump refuse to start on most big endian hosts,
because ef_verify_config() chokes on mdchr_ca[]:
Config meta uid 0 field type: value 0 is not in symbol table meta-type
Config meta uid 1 field type: value 0 is not in symbol table meta-type
Config meta uid 2 field type: value 0 is not in symbol table meta-type
Config meta uid 3 field type: value 0 is not in symbol table meta-type
Config meta uid 4 field type: value 0 is not in symbol table meta-type
Broken in commit
06a0036 (v4.3.12), which changed struct castr member
ca_type from packed_nsc_type (typedef'ed to char) to enum nsc_type,
but neglected to update the ca_type in mdchr_ca[].
On little endian hosts, the selector reads the least significant byte,
with sign extension. Happens to work, because the type values are all
sufficiently small integers.
On big endian hosts, the selector reads the most signiciant byte.
which is always zero (NSC_NOTYPE). Makes ef_verify_config() fail.
Except when sizeof(enum nsc_notype) == 1. Then selector type works
fine, and ef_verify_config() succeeds, but we run into the next
problem: the same commit also changed member ca_flags from nsc_flags
(typedef'ed to unsigned char) to int without updating the ca_type in
mdchr_ca[]. This breaks "only" xdump meta column flags.
v4.3.12 was released in April 2008. Either nobody has tried to run a
game on a big endian host since, or all who did gave up quietly,
without reporting the problem.
We clearly need to test on a wider range of machines.
/* no need for uid */
/* name must come first, clients may rely on it */
{"name", fldoff(ca_name), NSC_STRING, 0, NULL, EF_BAD, NSC_CONST},
- {"type", fldoff(ca_type), NSC_CHAR, 0, NULL, EF_META_TYPE, NSC_CONST},
- {"flags", fldoff(ca_flags), NSC_UCHAR, 0, NULL,
+ {"type", fldoff(ca_type), NSC_SITYPE(enum nsc_type), 0, NULL,
+ EF_META_TYPE, NSC_CONST},
+ {"flags", fldoff(ca_flags), NSC_INT, 0, NULL,
EF_META_FLAGS, NSC_CONST | NSC_BITS},
{"len", fldoff(ca_len), NSC_USHORT, 0, NULL, EF_BAD, NSC_CONST},
{"table", fldoff(ca_table), NSC_INT, 0, NULL, EF_TABLE, NSC_CONST},
[0:640] Command : XDUMP meta meta 0
"name" 3 4 0 -1
-"type" 4 4 0 34
-"flags" 5 12 0 33
+"type" 8 4 0 34
+"flags" 8 12 0 33
"len" 7 4 0 -1
"table" 8 4 0 27
/5
[0:636] Command : XDUMP meta meta 0
"name" 3 4 0 -1
-"type" 4 4 0 34
-"flags" 5 12 0 33
+"type" 8 4 0 34
+"flags" 8 12 0 33
"len" 7 4 0 -1
"table" 8 4 0 27
/5