From 6ef9a9e18471b9a57d2b28fd76b4b8e3840d3ffa Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 23 Aug 2019 15:32:56 +0200 Subject: [PATCH] tests: (column) use actually invalid multibytes to test encoding MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If reading an invalid multibyte sequence, column(1) will encode the byte as "\x" 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 --- 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 ea40a34e9f..5b0c745036 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 a9e371003b..4fcf44eb31 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.47.3