Thursday 22 November 2018

the in-progress transition, icu, arm64 and nans

Hi,

By my reading, the single thing blocking the migration of a whole bunch of packages out of disco-proposed is the autopkgtest failure of symfony on arm64.

Unfortunately, this failure is not a flaky test: it is due to a behaviour change in ICU.

On disco-proposed:

root@Mcdivitt-B0-Cartridge37:/# cat int64test.c
#include <string.h>
#include <stdio.h>
#include <unicode/unum.h>

int main(int argc, char** argv) {
        UErrorCode status;
        UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
        UChar u_str[1000];
        int32_t length;
        u_strFromUTF8(u_str, 1000, &length, argv[1], strlen(argv[1]), &status);
        int64_t r = unum_parseInt64(nf, u_str, length, NULL, &status);
        printf("result %ld status %d\n", r, U_FAILURE(status));
}
root@Mcdivitt-B0-Cartridge37:/# gcc -o int64test int64test.c  -licuuc -licui18n
root@Mcdivitt-B0-Cartridge37:/# ./int64test nan
result 0 status 0

Compiling the same source without proposed enabled:

ubuntu@Mcdivitt-B0-Cartridge37:~$ ./int64test nan
result 0 status 1

FWIW, ./int64test NaN behaves like disco-proposed always (on arm64...), and symfony has special code handling "NaN", so a reasonable expedient fix is probably to patch symfony to not be case sensitive there.

Given that this only seems to happen on arm64 and not, say, amd64, my guess is that it's also an ICU bug but ICU is pretty confusing and documentation on intended behaviour of how NaN should be handled by number parsing seems to be non-existent.

Hope this helps someone.

Cheers,
mwh