]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (column) use actually invalid multibytes to test encoding
authorPatrick Steinhardt <ps@pks.im>
Fri, 23 Aug 2019 13:32:56 +0000 (15:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Aug 2019 07:36:50 +0000 (09:36 +0200)
If reading an invalid multibyte sequence, column(1) will encode the byte
as "\x<hex>" instead. The tests try to verify that by piping "£" into
column(1). As the tests run with LC_ALL=POSIX by default, though, libc
implementations strictly adhering to the POSIX standard will treat all
characters as valid multibyte characters. As a consequence, no EILSEQ is
raised by mbtowc(3P) and the character is not encoded as hex, breaking
the test.

Fix this by setting LC_ALL=C.UTF-8. As "£" is a valid UTF-8 character,
we also change the test to use a proper illegal multibyte sequence.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
tests/expected/column/invalid-multibyte
tests/ts/column/invalid-multibyte

index ea40a34e9f78e6661a050c9ad4efd952c9ab0b12..5b0c745036de4ba4f52f1f5f7792ab75df9e121e 100644 (file)
@@ -1 +1 @@
-\xa3
+\x94~
index a9e371003ba295cbebcffa906fee68ced7e48059..4fcf44eb31e7118cea785aa96fd34d34cc865341 100755 (executable)
@@ -25,6 +25,6 @@ ts_check_test_command "$TS_CMD_COLUMN"
 
 ts_cd "$TS_OUTDIR"
 
-printf "£\n" | LC_ALL=C $TS_CMD_COLUMN >> $TS_OUTPUT 2>&1
+printf "\x94\x7e\n" | LC_ALL=C.UTF-8 $TS_CMD_COLUMN >> $TS_OUTPUT 2>&1
 
 ts_finalize