aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-01-30 10:33:59 +0000
committerRon Yorston <rmy@pobox.com>2023-01-30 10:33:59 +0000
commit7a537eb71874cd6c8d0e9ab1f906e6466e7f793c (patch)
treeaf7b8c0218c5bc8b3e7c7aa5d86beca68350446f /testsuite
parent33ae88c40cf56b53c06e627e0535c9c740767aa4 (diff)
downloadbusybox-w32-7a537eb71874cd6c8d0e9ab1f906e6466e7f793c.tar.gz
busybox-w32-7a537eb71874cd6c8d0e9ab1f906e6466e7f793c.tar.bz2
busybox-w32-7a537eb71874cd6c8d0e9ab1f906e6466e7f793c.zip
awk: CRLF handling
Previous efforts at handling DOS-style line endings in awk have included commits ee7e00dc5 and 1a3717342. The use of remove_cr() is unwise: - It's overzealous, removing all CRs, not just those in CRLF pairs. - Even if that were fixed awk reads input in chunks. There's a remote chance a CRLF might appear at a chunk boundary and be missed. remove_cr() will be fixed separately. In awk treat all data input as being in text mode. Skipping CRs in skip_spaces() is also flawed. Instead read scripts in text mode. Add a couple of test cases. One of these (awk backslash+CRLF eaten with no trace) fails without this patch.
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests14
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index bbf0fbff1..11beb1b10 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -485,4 +485,18 @@ testing 'awk assign while test' \
485 "" \ 485 "" \
486 "foo" 486 "foo"
487 487
488optional PLATFORM_MINGW32
489testing 'awk match line ending' \
490 "awk '/world$/'" \
491 "world\n" \
492 "" \
493 "hello\r\nworld\r\n"
494
495testing 'awk backslash+CRLF eaten with no trace' \
496 "awk -f -" \
497 "Hello world\n" \
498 '' \
499 'BEGIN { printf "Hello\\\r\n world\\n" }\n'
500SKIP=
501
488exit $FAILCOUNT 502exit $FAILCOUNT