[tlbuild] xetex on sparc-solaris dumps core using opentype fonts

Karl Berry karl at freefriends.org
Fri Jun 17 19:10:38 CEST 2011


Indeed, the crash is about word swapping.  (Every year there are new
useless endian problems.  How frustrating.)

b CMAPMapper::createUnicodeMapper  # in web2c/xetexdir/cmaps.cpp
r -ini
This is XeTeX, ...
**\font\z="Zapfino"\relax  % on darwin, or ="Fixed"\relax elsewhere, or...

The first executable line in the fn is the same for both TL'10 and TL'11:
 le_uint16 nSubtables = SWAPW(cmap->numberSubtables);

n
p nSubtables

The result is the correct 2 in TL'10, and an incorrect 512 in TL'11.

If you s(tep) into that call instead of n(ext) past it, it will go to
the definition of SWAPW, namely the LESwaps::swapWord function from
our source file libs/icu/icu-*/layout/LESwaps.h.

TL'10 uses ICU 4.4.  In that case, the code looks like this:
#define SWAPW(value) LESwaps::swapWord((const le_uint16 &) (value))
..
    static le_uint16 swapWord(const le_uint16 &value)
    {
        const le_uint8 *p = (const le_uint8 *) &value;
        return ((p[0] << 8) + p[1]);
    };


TL'11 uses ICU 4.6.  In that case, the code looks like this:
#define SWAPW(value) LESwaps::swapWord((le_uint16)(value))
..
    static le_uint16 swapWord(le_uint16 value)
    {
        return (le_uint16)((value << 8) | (value >> 8));
    };

The former works, the latter doesn't.  I cannot make out the reason,
given the change in C++ types, pointers, etc.

But a more fundamental question occurs to me.  The comments (and names)
for these functions indicate they are for *little* endian machine.  So
why are we here at all on our BigEndian machines (in either case, TL'10
or TL'11)?  Seems wrong.  Perhaps it was just an accident that it worked
in '10.  On the other hand, I don't see any attempt at endian detection
in ICU; these LE* files seem to be unconditionally included and used.

I'll keep looking, but I hope all this triggers an idea for someone else :).

karl


More information about the tlbuild mailing list