]> git.ipfire.org Git - thirdparty/util-linux.git/commit
tests: (colcrt) fix reliance on EILSEQ in POSIX locale
authorPatrick Steinhardt <ps@pks.im>
Fri, 23 Aug 2019 13:32:55 +0000 (15:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Aug 2019 07:36:38 +0000 (09:36 +0200)
commit5718f8d96b90871dc4ff759be4164f6daf4f6161
tree15069f96c4ede4fd01442992df49ab85c5ae9526
parent8892f94c5777dd667b963ac70f48c3c8ac05c880
tests: (colcrt) fix reliance on EILSEQ in POSIX locale

The input file "crash1" in the colcrt/regressions test contains the
illegal byte sequence "\x94\x7e". While "\x7e" is '~', "\x94" is not a
valid character. Thus, the test assumes that getwc(3P) will return
`WEOF` and set `errno=EILSEQ`, causing colcrt(1) to abort reading the
stream and thus not print the trailing '~'.

This assumption holds just fine for glibc as it will dutifully report
EILSEQ, but musl libc will happily read the complete stream without
complaining about the illegal character. But in fact, as tests run with
LC_ALL=POSIX by default, glibc's behaviour is wrong while musl is right.
Quoting mbrtowc(3P) from POSIX.1-2017:

    [EILSEQ] An invalid character sequence is detected. In the POSIX locale an
             [EILSEQ] error cannot occur since all byte values are valid
             characters.

Fix the issue by running the colcrt tests with C.UTF8 locale.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
tests/ts/colcrt/regressions