Re: [PATCH 2/2] Support sizes >=2G in various config options accepting 'g' sizes.

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/2] Support sizes >=2G in various config options accepting 'g' sizes.

From: Nix <hidden>
Date: 2016-06-15 22:51:58

On 5 Sep 2011, Sverre Rabbelier said:
Heya,

On Mon, Sep 5, 2011 at 13:45, Nix [off-list ref] wrote:
quoted
32-bit platforms with no type larger than 'long' cannot detect this
case and will continue to silently misbehave, but the misbehaviour
will be somewhat different and more useful, since bigFileThreshold was
also being mistakenly treated as a signed value when it should have
been unsigned.
Is it not possible to detect that the target value won't fit in the
max size of an int when parsing the config value?
Well, we're parsing longs, not ints. If sizeof(long)>sizeof(int), or we
have long long and sizeof(long long)>sizeof(int), then we can always
detect overflows when saving into the appropriate type: but if we don't
have long long, or if we have neither strto(u)ll() nor strto[ui]max(),
we could only detect overflow by looking at the raw text string and
checking it by hand to see if it would fit. I judged this pointless
extra complexity for a very rare edge case (machines with neither
strot(u)ll() nor strto[ui]max() are generally quite old and people
aren't going to be specifying sizes in gigabytes on such machines
anyway.)

-- 
NULL && (void)

Re: [PATCH 2/2] Support sizes >=2G in various config options accepting 'g' sizes.

From: Clemens Buchacher <hidden>
Date: 2016-06-15 22:51:59

On Mon, Sep 05, 2011 at 02:56:10PM +0100, Nix wrote:
Well, we're parsing longs, not ints. If sizeof(long)>sizeof(int), or we
have long long and sizeof(long long)>sizeof(int), then we can always
detect overflows when saving into the appropriate type: but if we don't
have long long, or if we have neither strto(u)ll() nor strto[ui]max(),
we could only detect overflow by looking at the raw text string and
checking it by hand to see if it would fit. I judged this pointless
extra complexity for a very rare edge case (machines with neither
strot(u)ll() nor strto[ui]max() are generally quite old and people
aren't going to be specifying sizes in gigabytes on such machines
anyway.)
Is this also true for Windows and other platforms?

And I don't think it's about whether or not people are likely to
specify sizes in gigabytes on old machines. People are bound to
blindly copy configuration files from one machine to another. In
any case, my expectation would be for the configuration options to
do what I tell them, or error out if they do not make sense.

Clemens
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help