Skip to content

test_ffi_key_set_expiry_multiple_uids fails in year 2041 #2371

@bmwiedemann

Description

@bmwiedemann

While working on reproducible builds for openSUSE, I found that
our rnp v0.18.0 package stops passing its tests after 2041-05-13, likely because some of the test data has expiration date set there.

Test log:

[ RUN      ] rnp_tests.test_ffi_key_set_expiry_multiple_uids
/home/abuild/rpmbuild/BUILD/rnp-0.18.0-build/rnp-v0.18.0/src/tests/ffi-key-prop.cpp:125: Failure
Value of: (expired)
  Actual: true
Expected: false

[  FAILED  ] rnp_tests.test_ffi_key_set_expiry_multiple_uids (477 ms)

referring to this code:

    assert_rnp_success(rnp_locate_key(ffi, "userid", "Alice <alice@rnp>", &key));   
    expiry = 0;
    assert_rnp_success(rnp_key_get_expiration(key, &expiry));
    assert_int_equal(expiry, 674700647);
    assert_rnp_success(rnp_key_is_expired(key, &expired));
    assert_false(expired);

Background:
As part of my work on reproducible builds for openSUSE, I check that software still gives identical build results in the future.
The usual offset is +16 years, because that is how long I expect some software will be used in some places.
This showed up failing tests in our package build.
See https://reproducible-builds.org/ for why this matters.

Possible approaches are:

  • mock the date
  • set the expiry to the far future (e.g. year 2105, or further if the format allows it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions