Skip to content

Fix 32bit#275

Open
erayaslan wants to merge 2 commits intodovecot:mainfrom
erayaslan:fix-32bit
Open

Fix 32bit#275
erayaslan wants to merge 2 commits intodovecot:mainfrom
erayaslan:fix-32bit

Conversation

@erayaslan
Copy link
Copy Markdown

@erayaslan erayaslan commented Mar 31, 2026

Two tests fail in 32 bit (x86, ppc32 and arm32) systems:

1/ event filter: sizes with different interval units .................... : FAILED

and

2/ FAIL: test-imap-date

test-imap-date.c:46: Assert(#2) failed: tests[i].timestamp == ts
-23296 == -1 is not true
test-imap-date.c:49: Assert(#0) failed: !imap_parse_date(invalid_tests[i], &ts)
test-imap-date.c:49: Assert(#1) failed: !imap_parse_date(invalid_tests[i], &ts)
test-imap-date.c:49: Assert(#2) failed: !imap_parse_date(invalid_tests[i], &ts)
imap_parse_date() .................................................... : FAILED
test-imap-date.c:93: Assert(#2) failed: tests[i].timestamp == ts
2147483647 == -1 is not true
imap_parse_date() .................................................... : FAILED
2 / 2 tests failed

First one is just test values overflowing long in 32 bit and the second one seems to be an off-by-one error

On 32-bit systems with signed time_t (e.g. x86), the gmtime_max
configure test incorrectly reports TIME_T_MAX_BITS=32 instead of 31.

Change the loop bound from sizeof(time_t)*8 to sizeof(time_t)*8 - 1, so
on 32-bit signed time_t the loop stops at bits < 31, exits with bits =
31, and TIME_T_MAX_BITS is correctly set to 31 instead of the buggy 32.
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Mar 31, 2026
Two tests fail in 32 bit systems. First one is just test values
overflowing long in 32 bit. Second one seems to be an off-by-one error

Also see dovecot/core#275

Closes: https://bugs.gentoo.org/971763
Signed-off-by: Eray Aslan <eras@gentoo.org>
@sirainen
Copy link
Copy Markdown
Contributor

This is more or less a duplicate of #247 which is also unfortunately a bit stuck, because to me it looks like the time_t bits handling is all messed up and I haven't spent time understanding if the current changes are good or if something more should be done.

@sirainen
Copy link
Copy Markdown
Contributor

Possibly Dovecot shouldn't even pretend to support unsigned time_t. I don't think there are any such supported systems, so we could just have configure fail if time_t is unsigned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants