aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-02-10 12:54:03 +0000
committerRon Yorston <rmy@pobox.com>2023-02-10 13:21:02 +0000
commitd9916c6344c806696554115baa764eea09ca5f08 (patch)
treea25f6f4aaf4e91915b615af7e4bbc09bd68f6ac9 /testsuite
parent4b894b60ae377ee2a04ae209c14bb1e714ecf6f4 (diff)
downloadbusybox-w32-d9916c6344c806696554115baa764eea09ca5f08.tar.gz
busybox-w32-d9916c6344c806696554115baa764eea09ca5f08.tar.bz2
busybox-w32-d9916c6344c806696554115baa764eea09ca5f08.zip
ash: remove CRs from CRLF during field splitting
Commit e371e46fa0 (shell: add \r to IFS) added '\r' to the IFS variable so field splitting would remove carriage returns. Rather than change IFS, remove CRs preceding LFs in regions being scanned for field splitting before IFS is applied. This prevents free-standing CRs from being removed. Costs 112-120 bytes. (GitHub issue #285)
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/sh.tests6
1 files changed, 5 insertions, 1 deletions
diff --git a/testsuite/sh.tests b/testsuite/sh.tests
index 872611a1b..6fc3ca104 100755
--- a/testsuite/sh.tests
+++ b/testsuite/sh.tests
@@ -89,8 +89,12 @@ IyEvYmluL3NoICAtIAplY2hvICJIZWxsbyB3b3JsZCIK
89" 89"
90rm -f shebang_leading_argument_trailing_space.sh 90rm -f shebang_leading_argument_trailing_space.sh
91 91
92testing "remove CRs from string being evaluated" \ 92testing "sh remove CRs from string being evaluated" \
93 "sh -c \"$(printf 'set -e\r\necho Hello world\r\n')\"" \ 93 "sh -c \"$(printf 'set -e\r\necho Hello world\r\n')\"" \
94 "Hello world\n" "" "" 94 "Hello world\n" "" ""
95 95
96testing "sh preserve lone CRs during field splitting" \
97 "sh input" \
98 "Hello\r world\n" "echo \$(printf \"Hello\\\\r\\\\r\\\\nworld\\\\r\\\\n\")" ""
99
96exit $FAILCOUNT 100exit $FAILCOUNT