Skip to content

test_expando_node_conddate fails after year 2038 #4877

@bmwiedemann

Description

@bmwiedemann

NeoMutt Version

PUT YOUR "neomutt -v" OUTPUT HERE

neomutt-20260406

Expected Behaviour

I ran the openSUSE package build with a date set beyond 2038-01-19 .
The build includes a make test with https://github.com/neomutt/neomutt-test-files
Normally, it passes, but when the date is after 2038-01-19 when UNIX timestamps don't fit into signed int anymore, there was one failed test.

Actual Behaviour

    Test test_expando_node_conddate...              [ FAILED ]
      Case %<[2M?aaa&bbb>:
        node_conddate.c:155: test_check_num_eq... failed
          Expected : 1
          Actual   : 0
      Case %<[1M?aaa&bbb>:
        node_conddate.c:155: test_check_num_eq... failed
          Expected : 1
          Actual   : 0
...
FAILED: 1 of 564 unit tests has failed.

Steps to Reproduce

osc checkout openSUSE:Factory/neomutt && cd $_
osc build --vm-type=kvm --noservice --clean --build-opt=--vm-custom-opt="-rtc base=2042-01-25T00:00:00" standard

Maybe you can also trigger it with libfaketime.

How often does this happen?

  • Always when date is >2038-01-19

When did it start to happen?

  • When we started to run tests in our package build 2025-09-05

Extra Info

  • Operating System and its version: openSUSE Tumbleweed 20260520
  • Were you using multiple copies of NeoMutt at once? no
  • Were you using 'screen' or 'tmux'? no
  • Is your email local (maildir) or remote (IMAP)? does not apply

--

I tried this, but it did not fix it:

--- a/test/expando/node_conddate.c
+++ b/test/expando/node_conddate.c
@@ -149,7 +149,7 @@ void test_expando_node_conddate(void)
       struct ExpandoNode *node = node_conddate_parse(test_dates[i].str + 2, 1, 2, &parsed_until, &err);
       TEST_CHECK(node != NULL);

-      int test_date = now - ((test_dates[i].time * 9) / 10); // 10% newer
+      time_t test_date = now - ((test_dates[i].time * 9) / 10); // 10% newer

       int rc = node_conddate_render(node, TestRenderCallback, buf, 99, &test_date, MUTT_FORMAT_NO_FLAGS);
       TEST_CHECK_NUM_EQ(rc, 1);
@@ -198,7 +198,7 @@ void test_expando_node_conddate(void)
       struct ExpandoNode *node = node_conddate_parse(test_dates[i].str + 2, 1, 2, &parsed_until, &err);
       TEST_CHECK(node != NULL);

-      int test_date = now - ((test_dates[i].time * 11) / 10); // 10% older
+      time_t test_date = now - ((test_dates[i].time * 11) / 10); // 10% older

       int rc = node_conddate_render(node, TestRenderCallback, buf, 99, &test_date, MUTT_FORMAT_NO_FLAGS);
       TEST_CHECK_NUM_EQ(rc, 0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions