Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tests to pass after 2038 #1838

Merged
merged 2 commits into from
Jan 20, 2023
Merged

Conversation

bmwiedemann
Copy link
Contributor

@bmwiedemann bmwiedemann commented Jan 13, 2023

new deadline is 2242-03-16

https://wiki.osdev.org/USTAR documents the 12-byte octal time format
that provides 12*3 = 36 bits for mtime.

Fixes #1837

@bmwiedemann bmwiedemann force-pushed the ftbfs2038 branch 3 times, most recently from 608ae9f to 805edd5 Compare January 13, 2023 11:50
@kientzle
Copy link
Contributor

One clarification: POSIX requires that the 12-byte field include at least one terminator character which must be space or NULL. That limits you to 33 bits (11 bytes) in a fully standards-conforming implementation. (Libarchive is willing to bend these rules, but in this particular case, I don"t see any reason to go beyond 33 bits right now.)

new deadline is 2242-03-16

https://wiki.osdev.org/USTAR documents the 12-byte octal time format
that provides 12*3 = 36 bits for mtime.
But apparently POSIX requires a terminator byte that reduces it to 33 bits.
https://pubs.opengroup.org/onlinepubs/7908799/xcu/pax.html#tag_001_014_1700_006

Fixes libarchive#1837

This patch was done while working on reproducible builds for openSUSE.
@kientzle
Copy link
Contributor

Nice! Thanks for working through this so conscientously!

@kientzle kientzle merged commit 9079959 into libarchive:master Jan 20, 2023
@emaste
Copy link
Contributor

emaste commented May 30, 2023

I tested with this change merged into FreeBSD base (as part of the project to update to OpenSSL 3) and see:

/tmp/cirrus-ci-build/contrib/libarchive/libarchive/archive_write_set_format_pax.c:1134:39: error: result of comparison of constant 8589934591 with expression of type "time_t" (aka "int") is always false [-Werror,-Wtautological-constant-out-of-range-compare]
                || (archive_entry_mtime(entry_main) >= USTAR_MAX_MTIME)))
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/tmp/cirrus-ci-build/contrib/libarchive/libarchive/archive_write_set_format_pax.c:1199:39: error: result of comparison of constant 8589934591 with expression of type "time_t" (aka "int") is always false [-Werror,-Wtautological-constant-out-of-range-compare]
                    archive_entry_mtime(entry_main) >= USTAR_MAX_MTIME  ||
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/tmp/cirrus-ci-build/contrib/libarchive/libarchive/archive_write_set_format_pax.c:1437:9: error: result of comparison of constant 8589934591 with expression of type "time_t" (aka "int") is always false [-Werror,-Wtautological-constant-out-of-range-compare]
                if (s > USTAR_MAX_MTIME) { s = USTAR_MAX_MTIME; }
                    ~ ^ ~~~~~~~~~~~~~~~
/tmp/cirrus-ci-build/contrib/libarchive/libarchive/archive_write_set_format_pax.c:1437:34: error: implicit conversion from "long long" to "time_t" (aka "int") changes value from 8589934591 to -1 [-Werror,-Wconstant-conversion]
                if (s > USTAR_MAX_MTIME) { s = USTAR_MAX_MTIME; }
                                             ~ ^~~~~~~~~~~~~~~
/tmp/cirrus-ci-build/contrib/libarchive/libarchive/archive_write_set_format_pax.c:55:25: note: expanded from macro "USTAR_MAX_MTIME"
#define USTAR_MAX_MTIME 0x1ffffffff
                        ^~~~~~~~~~~
4 errors generated.
*** [archive_write_set_format_pax.o] Error code 1

@emaste
Copy link
Contributor

emaste commented May 30, 2023

From the COMPAT_32BIT build, which is building for i386 with 32-bit time_t.

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.

bsdtar_test_option_C_mtree fails in 2038
3 participants