From: Patrick Steinhardt <ps@pks.im> To: util-linux@vger.kernel.org Cc: Patrick Steinhardt <ps@pks.im>, Karel Zak <kzak@redhat.com> Subject: [PATCH v2 3/6] tests: colcrt: fix reliance on EILSEQ in POSIX locale Date: Fri, 23 Aug 2019 15:32:55 +0200 Message-ID: <ac1dfeb380dadc07cf6939fee24338406f908f1d.1566566906.git.ps@pks.im> (raw) In-Reply-To: <cover.1566566906.git.ps@pks.im> 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ts/colcrt/regressions b/tests/ts/colcrt/regressions index 394c4e823..2adeea3f3 100755 --- a/tests/ts/colcrt/regressions +++ b/tests/ts/colcrt/regressions @@ -24,7 +24,7 @@ ts_check_prog "timeout" check_input_file() { ts_init_subtest ${1##*/} - timeout 2 $TS_CMD_COLCRT < $1 > $TS_OUTPUT 2>&1 + LC_ALL=C.UTF-8 timeout 2 $TS_CMD_COLCRT < $1 > $TS_OUTPUT 2>&1 echo "return value: $?" >> $TS_OUTPUT ts_finalize_subtest } -- 2.23.0
next prev parent reply index Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-23 10:16 [PATCH 0/6] Test suite fixes for musl libc Patrick Steinhardt 2019-08-23 10:16 ` [PATCH 1/6] tests: remove reliance on buffer behaviour of stderr/stdout streams Patrick Steinhardt 2019-08-23 10:16 ` [PATCH 2/6] tests: colcrt: fix reliance on EILSEQ in POSIX locale Patrick Steinhardt 2019-08-23 10:17 ` [PATCH 3/6] tests: column: use actually invalid multibytes to test encoding Patrick Steinhardt 2019-08-23 10:17 ` [PATCH 4/6] tests: col: avoid hardcoding of errno string Patrick Steinhardt 2019-08-23 10:17 ` [PATCH 5/6] tests: fdisk: " Patrick Steinhardt 2019-08-23 10:17 ` [PATCH 6/6] tests: libfdisk: remove reliance on buffer behaviour of standard streams Patrick Steinhardt 2019-08-23 12:15 ` Karel Zak 2019-08-23 13:32 ` [PATCH v2 0/6] Test suite fixes for musl libc Patrick Steinhardt 2019-08-23 13:32 ` [PATCH v2 1/6] tests: remove reliance on buffer behaviour of stderr/stdout streams Patrick Steinhardt 2019-08-27 11:17 ` Karel Zak 2019-08-27 11:49 ` Patrick Steinhardt 2019-08-27 12:32 ` Karel Zak 2019-08-27 11:55 ` Patrick Steinhardt 2019-08-27 12:31 ` Karel Zak 2019-08-27 12:26 ` [PATCH] tests: use env and support both unbuffer/stdbuf Patrick Steinhardt 2019-08-27 12:46 ` Karel Zak 2019-08-28 10:51 ` Karel Zak 2019-08-30 19:08 ` Karel Zak 2019-08-31 7:41 ` Patrick Steinhardt 2019-08-23 13:32 ` [PATCH v2 2/6] tests: libfdisk: remove reliance on buffer behaviour of standard streams Patrick Steinhardt 2019-08-23 13:32 ` Patrick Steinhardt [this message] 2019-08-23 13:32 ` [PATCH v2 4/6] tests: column: use actually invalid multibytes to test encoding Patrick Steinhardt 2019-08-23 13:32 ` [PATCH v2 5/6] tests: col: avoid hardcoding of errno string Patrick Steinhardt 2019-08-23 13:32 ` [PATCH v2 6/6] tests: fdisk: " Patrick Steinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ac1dfeb380dadc07cf6939fee24338406f908f1d.1566566906.git.ps@pks.im \ --to=ps@pks.im \ --cc=kzak@redhat.com \ --cc=util-linux@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Util-Linux Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \ util-linux@vger.kernel.org public-inbox-index util-linux Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux AGPL code for this site: git clone https://public-inbox.org/public-inbox.git