busybox/shell/ash_test/ash-read
Ron Yorston dcd8df258a shell: improve bash compatibility of read built-in
Make the read built-in more compatible with bash:

- Return an exit code of 142 on timeout.

- When the timeout expires before a newline is detected in the
  input bash captures the partial input.  This behaviour is new
  since bash version 4.4.  BusyBox shells had the pre-4.4 behaviour
  where the input was lost.

Update the tests to suit and fix a couple of compiler errors in
the testsuite.

function                                             old     new   delta
builtin_read                                         154     174     +20
readcmd                                              213     228     +15
shell_builtin_read                                  1364    1370      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2025-07-01 20:21:37 +02:00
..
read_d0.right shell: Fix "read -d ''" behavior 2020-07-31 18:42:30 +02:00
read_d0.tests shell: Fix "read -d ''" behavior 2020-07-31 18:42:30 +02:00
read_ifs.right ash: fix for read $IFS splitting. Closes bug 235 2010-01-08 15:44:07 +01:00
read_ifs.tests ash: fix for read $IFS splitting. Closes bug 235 2010-01-08 15:44:07 +01:00
read_ifs2.right shell: improve bash compatibility of read built-in 2025-07-01 20:21:37 +02:00
read_ifs2.tests shell: improve bash compatibility of read built-in 2025-07-01 20:21:37 +02:00
read_n.right ash: add read -u; fix read -t and read -n; add testsuite entries. 2008-03-25 00:07:12 +00:00
read_n.tests ash: add read -u; fix read -t and read -n; add testsuite entries. 2008-03-25 00:07:12 +00:00
read_r.right ash: add read -u; fix read -t and read -n; add testsuite entries. 2008-03-25 00:07:12 +00:00
read_r.tests ash testsuite: remove two inadvertent bashisms 2016-10-01 17:30:21 +02:00
read_REPLY.right shell: split read builtin from ash 2010-01-12 22:11:24 +01:00
read_REPLY.tests shell: split read builtin from ash 2010-01-12 22:11:24 +01:00
read_SIGCHLD.right ash,hush: fix SIGCHLD interrupting read builtin 2017-05-22 19:34:45 +02:00
read_SIGCHLD.tests ash,hush: fix SIGCHLD interrupting read builtin 2017-05-22 19:34:45 +02:00
read_t.right shell: improve bash compatibility of read built-in 2025-07-01 20:21:37 +02:00
read_t.tests shell: improve bash compatibility of read built-in 2025-07-01 20:21:37 +02:00
read_t0.right shell: optional support for read -t N.NNN, closes 10101 2017-07-20 16:09:31 +02:00
read_t0.tests shell: optional support for read -t N.NNN, closes 10101 2017-07-20 16:09:31 +02:00