#1027412 coreutils: shuf: -i EOVERFLOW when speccing either side of the range >2^32 (ILP32 only: limited to size_t?!?)

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
наб
Date:
2023-02-07 12:33:03 UTC
Severity:
normal
#1027412#5
Date:
2022-12-31 01:51:16 UTC
From:
To:
Dear Maintainer,

On x32 and i386 I observe:
-- >8 --
$ shuf -i 9223372036854775800-9223372036854775808
shuf: invalid input range: ‘9223372036854775800’: Value too large for defined data type
-- >8 --

But cannot reproduce this on amd64:
-- >8 --
$ shuf -i 9223372036854775800-9223372036854775808
9223372036854775803
9223372036854775805
9223372036854775800
9223372036854775808
9223372036854775802
9223372036854775806
9223372036854775807
9223372036854775801
9223372036854775804
-- >8 --

My brother in christ, just define the data type to be bigger.

The manual says nothing of this.

наб

#1027412#10
Date:
2023-02-07 12:31:47 UTC
From:
To:
The info manual does mention the range is as per "unsigned integers".
Since this is limited for all platforms, there isn't much advantage
in supporting the 64 bit range on 32 bit systems, given the current implementation.
Requiring large ranges would be very unusual. Note we also don't support negative
numbers which is another possibly more problematic limitation.
Assuming a reasonable amount of numbers are required, one can
easily / generally shift output to the desired range without limits
as described at https://bugs.gnu.org/61267

cheers,
Pádraig