busybox/shell/hush_test/hush-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
read_ifs.tests
read_ifs2.right hush: fix IFS handling in read 2018-04-11 17:18:34 +02:00
read_ifs2.tests hush: fix IFS handling in read 2018-04-11 17:18:34 +02:00
read_n.right
read_n.tests
read_r.right
read_r.tests hush testsuite: add many tests from ash testsuite 2016-10-02 17:39:31 +02:00
read_REPLY.right
read_REPLY.tests
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