bug#49217: 'shuf' returns nothing if the low range number is higher by 1 than the high number

2021-06-25 Thread Erik Auerswald
Hi, On Thu, Jun 24, 2021 at 09:19:36PM -0700, Paul Eggert wrote: > On 6/24/21 4:46 PM, F8ER F8ER wrote: > >For example, `shuf -i 101-100 -n 1` returns nothing with the exit code > >= 0 (unexpected). > > Actually, it's the expected behavior. It's the same behavior as > 'shuf -n 1 exactly 1

bug#49217: 'shuf' returns nothing if the low range number is higher by 1 than the high number

2021-06-25 Thread Erik Auerswald
Hi, On Fri, Jun 25, 2021 at 08:49:51AM +0200, Erik Auerswald wrote: > On Thu, Jun 24, 2021 at 09:19:36PM -0700, Paul Eggert wrote: > > On 6/24/21 4:46 PM, F8ER F8ER wrote: > > >For example, `shuf -i 101-100 -n 1` returns nothing with the exit code > > >= 0 (unexpected). > > > > Actually, it's

bug#49217: [PATCH] shuf: fix bug with "-i 1-0"

2021-06-25 Thread Erik Auerswald
"shuf -i 1-0" would mistakenly accept the invalid range without an error message and produce no output. Other invalid ranges, e.g., "shuf -i 2-0", would be detected and produce an error message, non-zero exit code, and no output. Bug reported by "F8ER F8ER." * src/shuf.c (main): Fix bug. *

bug#49217: 'shuf' returns nothing if the low range number is higher by 1 than the high number

2021-06-25 Thread Erik Auerswald
Hi, On Fri, Jun 25, 2021 at 08:54:43AM +0200, Erik Auerswald wrote: > On Fri, Jun 25, 2021 at 08:49:51AM +0200, Erik Auerswald wrote: > > On Thu, Jun 24, 2021 at 09:19:36PM -0700, Paul Eggert wrote: > > > On 6/24/21 4:46 PM, F8ER F8ER wrote: > > > >For example, `shuf -i 101-100 -n 1` returns

bug#49217: 'shuf' returns nothing if the low range number is higher by 1 than the high number

2021-06-25 Thread Paul Eggert
On 6/24/21 11:49 PM, Erik Auerswald wrote: $ shuf -i 2-0 ; echo %exit code $? shuf: invalid input range: ‘2-0’ %exit code 1 $ shuf -i 1-0 ; echo %exit code $? %exit code 0 This looks inconsistent and possibly not exactly as intended. It's exactly what I intended and

bug#49217: 'shuf' returns nothing if the low range number is higher by 1 than the high number

2021-06-25 Thread Erik Auerswald
Hi Paul, On Fri, Jun 25, 2021 at 09:29:04AM -0700, Paul Eggert wrote: > On 6/24/21 11:49 PM, Erik Auerswald wrote: > > $ shuf -i 2-0 ; echo %exit code $? > > shuf: invalid input range: ‘2-0’ > > %exit code 1 > > $ shuf -i 1-0 ; echo %exit code $? > > %exit code 0 > > > >This