aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-02-12 08:57:15 +0000
committerRon Yorston <rmy@pobox.com>2023-02-12 08:57:15 +0000
commit0f2feac4b7e518e838b80d7b8ceac8f9699ae997 (patch)
tree8f65b2d8487c72d1b0ca034b4c50585939915953 /testsuite
parentd9916c6344c806696554115baa764eea09ca5f08 (diff)
downloadbusybox-w32-0f2feac4b7e518e838b80d7b8ceac8f9699ae997.tar.gz
busybox-w32-0f2feac4b7e518e838b80d7b8ceac8f9699ae997.tar.bz2
busybox-w32-0f2feac4b7e518e838b80d7b8ceac8f9699ae997.zip
ash: improve CRLF handling in read
Commit deae0c7bf3 (Skip carriage return in read builtin command) caused all CRs to be removed from input to the read builtin. Only remove CRs that are part of a CRLF pair. Adds 64-80 bytes. (GitHub issue #285)
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/sh.tests16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/sh.tests b/testsuite/sh.tests
index 6fc3ca104..749d2dde2 100755
--- a/testsuite/sh.tests
+++ b/testsuite/sh.tests
@@ -97,4 +97,20 @@ testing "sh preserve lone CRs during field splitting" \
97 "sh input" \ 97 "sh input" \
98 "Hello\r world\n" "echo \$(printf \"Hello\\\\r\\\\r\\\\nworld\\\\r\\\\n\")" "" 98 "Hello\r world\n" "echo \$(printf \"Hello\\\\r\\\\r\\\\nworld\\\\r\\\\n\")" ""
99 99
100testing "sh read with CRLF" \
101 "printf '1 2\\r\\n' | { read var; printf \"\${var}\\\\n\"; }" \
102 "1 2\n" "" ""
103
104testing "sh read with CR" \
105 "printf '1\\r2\\r\\n' | { read var; printf \"\${var}\\\\n\"; }" \
106 "1\r2\n" "" ""
107
108testing "sh read with \\CRLF" \
109 "printf '1\\\\\r\\n2\\r\\n' | { read var; printf \"\${var}\\\\n\"; }" \
110 "12\n" "" ""
111
112testing "sh read with \\CR" \
113 "printf '1\\\\\r2\\r\\n' | { read var; printf \"\${var}\\\\n\"; }" \
114 "1\r2\n" "" ""
115
100exit $FAILCOUNT 116exit $FAILCOUNT