Re: tests: cal/bigyear only works on 64bit (sizeof(long) == 8) systems

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

 



On Sun, Dec 22, 2013 at 09:42:43PM -0500, Mike Frysinger wrote:
> the cal bigyear test uses a year of 1234567890123456789, but the parsing logic 
> reads it in like so:
> 	year = strtol_or_err(*argv++, _("illegal year value"));
> 
> that's a signed long type, so on 32bit systems, you get:
>           cal: Year 1234567890123456789       ...cal: illegal year value: 
> '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
> cal: illegal year value: '1234567890123456789': Numerical result out of range
>  FAILED (cal/bigyear)
> 
> should the test detect the sizeof(long) and then calculate a number that is 
> smaller than that ?

 It would be better to keep cal(1) arch insensitive.

 Sami, why we need so huge year numbers and why the number is signed? 
 I guess it would be enough to  use "unsigned int" (UINT_MAX is 4294967295).

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux