Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-07 Thread Chet Ramey
On 6/3/17 1:15 PM, Pranav Deshpande wrote: > Hello, > Sorry for the late reply. > > 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) That's a fine

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-04 Thread Eduardo Bustamante
On Sun, Jun 4, 2017 at 12:16 AM, dualbus wrote: [...] > 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

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-03 Thread Pranav Deshpande
Is that more advantageous? On Sun, Jun 4, 2017 at 10:46 AM, dualbus wrote: > 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 !=

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-03 Thread dualbus
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

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-03 Thread Pranav Deshpande
Hello, Sorry for the late reply. 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) Command: ./bash -c 'read -n0 <<< "abc";declare -p REPLY' Output: ./bash: line

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-05-31 Thread Pranav Deshpande
Thank you. I am travelling now and will look at it in 2 days. Regards, Pranav On May 31, 2017 7:48 PM, "Chet Ramey" wrote: > On 5/23/17 11:33 AM, Eduardo Bustamante wrote: > > (I think this is a good problem for Pranav to tackle if you consider > > this to be a bug, Chet).

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-05-31 Thread Chet Ramey
On 5/23/17 11:33 AM, Eduardo Bustamante wrote: > (I think this is a good problem for Pranav to tackle if you consider > this to be a bug, Chet). Thanks. Another one that he can look at and see how his solution compares to mine. Chet -- ``The lyf so short, the craft so long to lerne.'' -

Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-05-23 Thread Eduardo Bustamante
(I think this is a good problem for Pranav to tackle if you consider this to be a bug, Chet). Current behavior: dualbus@debian:~$ bash -c 'read -n0 <<< "abc"; declare -p REPLY' declare -- REPLY="abc" dualbus@debian:~$ bash --version|head -n1 GNU bash, version 4.4.11(1)-release