On 10/6/25 11:55 AM, Pourko via Bug reports for the GNU Bourne Again SHell wrote:
devel branch commit fbd078be0a0722544ebe229ab90f949ead24bb3d
In regard to: builtins/read.def
Some problems when calling the new function check_read_input()

If bash builtin read was invoked with the -t0 option, then we only need
to worry about changing terminal settings if a -d option was also supplied.
Any additional options (other than -d) on top of the -t0 option don't make
sense anyway, and should be ignored, as has been always in the past.

Thanks for the report.

The idea is that these should be the same conditions under which the read
builtin puts the terminal into character-at-a-time mode. You generalize a
zero timeout to tell the user what would happen if they issued a command without a timeout. So if you run `read -t0 -N 1' you get an indication of
whether a subsequent `read -N 1' will not block.

+      ct = (nflag || delim) && isatty (fd);
So this line should read

        ct = (nflag || delim != '\n') && isatty (fd);

This supports your use case as well.

2) delim is wrong.

That's why it needs to be delim != '\n'.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to