bash 'read' doesn't have exit status >1 on error

Paul Eggert <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Linux lnxsrv12.labidm.seas.ucla.edu 
5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 19 09:37:00 
EST 2024 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.3
Patch Level: 9
Release Status: release

Description:
The builtin 'read' command doesn't yield exit status >1 on error, as 
POSIX requires; see:

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/read.html#tag_20_100_14

Repeat-By:
bash -c 'read foo; echo $?' <&-

This command should output a diagnostic and then a number greater than 
1. The number it outputs is 1, unfortunately. Using the --posix option 
does not change things.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.