Re: Bug#760841: pspp: [kfreebsd] random testsuite failures
With some difficulty, I managed to reproduce the failure situation under
ktrace, so that I could diff with the successful case:
> u8-istream-test CALL read(0,0x640670,0x1000)
> -u8-istream-test GIO fd 0 read 13 bytes
> -0x0000 6500 6e00 7400 7200 e900 6500 0a
> +u8-istream-test GIO fd 0 read 14 bytes
> +0x0000 6500 6e00 7400 7200 e900 6500 0a00
> -u8-istream-test RET read 13/0xd
> +u8-istream-test RET read 14/0xe
The size of the read from fd 0 (stdin) was different; the last null
byte got truncated. I don't know why that is. The read is assumed to
be complete and it doesn't attempt to read again.
The effect is it will later decide the string is not valid UTF-16LE, so
treats it as CP1252, and doesn't properly convert it.
It seems logical this bug only happened for Little Endian encodings
(strings with Big Endian encoding will not end with a null byte).
> u8-istream-test CALL open(0x8012baba0,0<O_RDONLY>,<unused>0)
> u8-istream-test NAMI "/usr/lib/x86_64-kfreebsd-gnu/gconv/gconv-modules.cache"
> u8-istream-test RET open 3
> -u8-istream-test CALL fstat(0x3,0x7fffffffcf40)
> +u8-istream-test CALL fstat(0x3,0x7fffffffd190)
> u8-istream-test STRU invalid record
> u8-istream-test RET fstat 0
> u8-istream-test CALL mmap(0,0x6696,0x1<PROT_READ>,0x1<MAP_SHARED>,0x3,0)
> u8-istream-test RET mmap 34368200704/0x800812000
> u8-istream-test CALL close(0x3)
> u8-istream-test RET close 0
> -u8-istream-test CALL open(0x6499c0,0x100000<O_CLOEXEC>,<unused>0)
> -u8-istream-test NAMI "/usr/lib/x86_64-kfreebsd-gnu/gconv/CP1252.so"
> +u8-istream-test CALL open(0x6417d0,0x100000<O_CLOEXEC>,<unused>0)
> +u8-istream-test NAMI "/usr/lib/x86_64-kfreebsd-gnu/gconv/UTF-16.so"