From: Karel Zak <kzak@redhat.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: util-linux@vger.kernel.org, Sami Kerola <kerolasa@iki.fi>
Subject: Re: tests: cal/bigyear only works on 64bit (sizeof(long) == 8) systems
Date: Mon, 6 Jan 2014 13:30:40 +0100 [thread overview]
Message-ID: <20140106123040.GA31045@x2.net.home> (raw)
In-Reply-To: <201312222142.44536.vapier@gentoo.org>
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@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2014-01-06 12:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-23 2:42 tests: cal/bigyear only works on 64bit (sizeof(long) == 8) systems Mike Frysinger
2014-01-06 12:30 ` Karel Zak [this message]
2014-01-06 12:55 ` Sami Kerola
2014-01-06 13:08 ` Karel Zak
2014-01-06 23:21 ` Sami Kerola
2014-01-13 12:02 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140106123040.GA31045@x2.net.home \
--to=kzak@redhat.com \
--cc=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox