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

y2038: tests should not be failing if system date is set further than year 2037ish #11576

Closed
kanavin opened this issue Aug 2, 2023 · 13 comments

Comments

@kanavin
Copy link

kanavin commented Aug 2, 2023

I did this

To test the readiness of Yocto stack for Y2038 we run qemu virtual machines with RTC set to some day in 2040. This causes many of curl's tests to fail on both 32 bit and 64 bit systems: the reason is that curl's test cookies seem to set their expiry date to 2037 or so.

I would propose to set the expiry date to far enough in the future that it won't have to be tweaked in our lifetimes: this way real Y2038 issues in curl (or in things it depends on) can be exposed and fixed (it's well possible there are none, but that needs confirmation too).

Failures seen:
TESTFAIL: These test cases failed: 31 46 53 61 62 172 179 327 329 420 1104 1216 1415

If there's agreement on this, I can prepare the patch.

I expected the following

I expected 100% pass rate, same as when virtual machine's RTC is set to today.

curl/libcurl version

8.2.0

operating system

Linux qemux86-64 6.1.38-yocto-standard #1 SMP PREEMPT_DYNAMIC Thu Jul 6 18:52:54 UTC 2023 x86_64 GNU/Linux

@bagder
Copy link
Member

bagder commented Aug 2, 2023

Going beyond 2037 for dates in tests requires a > 32 bit time_t, which then means that the tests need to either exclude other platforms or they need to be written with conditions. I never bothered with either of those.

I don't know how common systems with small time_ts are.

@kanavin
Copy link
Author

kanavin commented Aug 2, 2023

All 64 bit architectures already use 64 bit time_t. Also more recent 32 bit platforms, like 32 bit risc-v do. Those are not going to be affected.

The problems are in legacy 32 bit: x86, arm, mips and ppc. On those, the userspace stack needs to be recompiled with '-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64', or dates after 2038 cannot be represented. Yocto has already made this transition, other distros have either abandoned 32 bit computing altogether (Red Hat, Ubuntu), or are trying to come up with a mass-rebuild plan (Debian). I'd say it's okay for the tests to fail on 32 bit platforms which are not ready for Y2038, as that will highlight the problem for them.

@bagder
Copy link
Member

bagder commented Aug 2, 2023

All 64 bit architectures already use 64 bit time_t

No they don't but all modern 64 bit architectures probably do.

Also more recent 32 bit platforms

Right. But as you might know, curl builds and is used widely also on old legacy platforms.

I'd say it's okay for the tests to fail on 32 bit platforms

I strongly disagree.

@kanavin
Copy link
Author

kanavin commented Aug 2, 2023

On 32 bit platforms which are not ready. People need to fix this stuff, and they need to fix it now.

@bagder
Copy link
Member

bagder commented Aug 2, 2023

The people who build curl on legacy platforms might not be the people who can do anything about their time_t problems so we would be inserting pain to the wrong people.

@kanavin
Copy link
Author

kanavin commented Aug 2, 2023

I mean, I can of course locally patch curl tests to not fail beyond 2037 and re-run the tests, but I'm surprised you don't want to do it.

@bagder
Copy link
Member

bagder commented Aug 2, 2023

I did not say that. I say it needs to be done correctly.

@bagder
Copy link
Member

bagder commented Aug 2, 2023

BTW, test 517 already verifies a few dates way after 2038 and before 1900.

@kanavin
Copy link
Author

kanavin commented Aug 2, 2023

BTW, test 517 already verifies a few dates way after 2038 and before 1900.

Does it? https://github.com/curl/curl/blob/master/tests/data/test517

@dfandrich
Copy link
Contributor

dfandrich commented Aug 2, 2023 via email

@kanavin
Copy link
Author

kanavin commented Aug 4, 2023

0001-tests-update-cookie-expiry-dates-to-far-in-the-futur.patch.txt

For reference, here's a patch that allows tests to pass in year 2040 on x86_64 Linux (I didn't get to testing 32 bit yet - just making a clean reference point first). It's all made of adjusting dates to far in the future.

@bagder
Copy link
Member

bagder commented Aug 6, 2023

If you want to work on fixing dates for curl testing in the future, then please submit your work as a PR!

kanavin pushed a commit to kanavin/curl that referenced this issue Aug 7, 2023
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors.

Upstream-Status: Pending [curl#11576]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
kanavin pushed a commit to kanavin/curl that referenced this issue Aug 7, 2023
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors.

Closes curl#11576
@bagder
Copy link
Member

bagder commented Aug 14, 2023

This is not actually a bug so I'm closing this issue. It is also being worked on in #11610

@bagder bagder closed this as completed Aug 14, 2023
kanavin pushed a commit to kanavin/curl that referenced this issue Aug 24, 2023
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors.

Closes curl#11576
kanavin pushed a commit to kanavin/curl that referenced this issue Aug 24, 2023
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors.

Closes curl#11576
kanavin pushed a commit to kanavin/curl that referenced this issue Aug 25, 2023
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors.

Closes curl#11576
kanavin pushed a commit to kanavin/curl that referenced this issue Aug 25, 2023
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors.

Closes curl#11576
bagder pushed a commit that referenced this issue Aug 25, 2023
This allows testing Y2038 with system time set to after that, so that
actual Y2038 issues can be exposed, and not masked by expiry errors.

Fixes #11576
Closes #11610
ptitSeb pushed a commit to wasix-org/curl that referenced this issue Sep 25, 2023
This allows testing Y2038 with system time set to after that, so that
actual Y2038 issues can be exposed, and not masked by expiry errors.

Fixes curl#11576
Closes curl#11610
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants