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.

That commit added the following snippet:

   if (have_timeout && tmsec == 0 && tmusec == 0)
+    {
+      int ct;    /* change terminal settings */
+
+      ct = (nflag || delim) && isatty (fd);
+      return (check_read_input (fd, ct) ? EXECUTION_SUCCESS : 
EXECUTION_FAILURE);
+    }

In the code above,
1) nflag is programatically correct, but logically unnecessary;
2) delim is wrong. It never triggers a change in terminal settings if 
builtin read was invoked with: read -t0 -d ""

FOR TEST:

$ foo (){ sleep 5; read -d "" -t0; echo "read RETURNED: $?";}
$ foo

While foo is sleeping, type in a few keystrokes.

RESULTS:

read RETURNED: 1
  ...if you have typed something, but not yet pressed ENTER;

read RETURNED: 0
  ...if you have pressed ENTER.

So,  read -d "" -t0  
still fails to detect available keys, which was the whole reason 
for this change in the first place.
https://lists.gnu.org/archive/html/bug-bash/2025-09/msg00347.html



Reply via email to