Hi Sam, Sam James <[email protected]> writes:
> (originally reported downstream at https://bugs.gentoo.org/969663) > > I see > FAIL: tests/misc/read-errors.sh > on a system with /bin/sh provided by dash rather than bash. > > The error messages from dash are different: > > /var/tmp/portage/sys-apps/coreutils-9.10/work/coreutils-9.10 # strace -o > /dev/null -P /dev/null -e /read,splice -e fault=all:error=EIO /bin/sh -c read > < /dev/null > /bin/sh: 1: read: arg count > > /var/tmp/portage/sys-apps/coreutils-9.10/work/coreutils-9.10 # strace -o > /dev/null -P /dev/null -e /read,splice -e fault=all:error=EIO /bin/bash -c > read < /dev/null > /bin/bash: line 1: read: 0: read error: Input/output error > > Full read-errors.log at > https://bugs.gentoo.org/attachment.cgi?id=954718. Thanks for the report. It looks like 'read' without a variable is a Bash extension, which stores the result in $REPLY [1]. POSIX's SYNOPSIS makes it look like at least one variable is required [2]. One would think the easy fix is to add a variable to the invocation. However, 'dash' annoyingly does not print any error message upon read(2) failing: $ strace -P /dev/null -e '/read,splice' -e fault=all:error=EIO bash -c 'read a < /dev/null' read(0, 0x559c9691f9e0, 4096) = -1 EIO (Input/output error) (INJECTED) bash: line 1: read: 0: read error: Input/output error $ strace -P /dev/null -e '/read,splice' -e fault=all:error=EIO dash -c 'read a < /dev/null' read(0, 0x7ffe7bde0aef, 1) = -1 EIO (Input/output error) (INJECTED) +++ exited with 1 +++ I'll have to think a bit more for a fix. Ideally this test shouldn't depend on bash or some other program. Collin [1] https://www.gnu.org/software/bash/manual/bash.html#Major-Differences-From-The-Bourne-Shell-1 [2] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/read.html
