On Sun, Jun 04, 2017 at 01:45:42AM +0530, Pranav Deshpande wrote: [...] > My solution is to change *line 294* of builtins/read.def. > > Change > if (code == 0 || *intval < 0* || intval != (int)intval) > > to > > if (code == 0 || i*ntval <= 0* || intval != (int)intval) [...]
> Is this solution ok? Yes. That works. Chet went with the other option though: dualbus@debian:~/src/gnu/bash-build$ ./bash -c 'read -n0; echo $?; declare -p REPLY' 0 declare -- REPLY="" You can see the change by navigating the `devel' branch of the git repository in Savannah (commit 1110e30870a8782425067a060d89cc411b014418): http://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=1110e30870a8782425067a060d89cc411b014418 Although there's a problem with the solution: dualbus@debian:~$ for sh in bash ~/src/gnu/bash-build/bash ksh93 mksh; do $sh -c ': | read -n 0; echo $?'; done 1 0 1 1 Since the read(2) system call doesn't take place, `read -n 0' doesn't detect the broken pipe. IMO, it should. -- Eduardo Bustamante https://dualbus.me/