[PATCH 3/6] tests: column: use actually invalid multibytes to test encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 tests/expected/column/invalid-multibyte | 2 +-
 tests/ts/column/invalid-multibyte       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/expected/column/invalid-multibyte b/tests/expected/column/invalid-multibyte
index ea40a34e9..5b0c74503 100644
--- a/tests/expected/column/invalid-multibyte
+++ b/tests/expected/column/invalid-multibyte
@@ -1 +1 @@
-\xa3
+\x94~
diff --git a/tests/ts/column/invalid-multibyte b/tests/ts/column/invalid-multibyte
index a9e371003..4fcf44eb3 100755
--- a/tests/ts/column/invalid-multibyte
+++ b/tests/ts/column/invalid-multibyte
@@ -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
-- 
2.23.0





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux