bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IGNOREEOF is ineffective when holds a big integer


From: shynur .
Subject: Re: IGNOREEOF is ineffective when holds a big integer
Date: Wed, 18 Jun 2025 03:59:52 +0000

Martin:
> In variables.c at line 6243 we have 
> eof_encountered_limit = (*temp && all_digits (temp)) ? atoi (temp) : 10;
>
> Presumably in your build of Bash, as in mine, `int` is 
> 32-bit, so the maximum value convertible by atoi would 
> be 2147483647.  Larger values are returned modulo 
> 4294967296 (with 2's complement sign handling).
> atoi("9223372036854775807") returns -1.
>
> (This does not limit the range that printf can handle; 
> it will normally cope with at least 64-bit (the size of
> `intmax_t` and/or `long int`).

Thank you very much! 
I checked `man printf`, and it says "widths are handled" and doesn’t accept the 
'%l' format specifier. 
So it does seem like the default is equivalent to C’s '%ull' rather than C’s 
'%u' (unsigned int). 

So, what’s the correct way to get INT_MAX? 
I’m not planning to use it in IGNOREEOF (I’ve already set `IGNOREEOF=127` in my 
`.bash_login`, which big enough), I’m just curious…


reply via email to

[Prev in Thread] Current Thread [Next in Thread]