Skip to content

Conversation

@vaintroub
Copy link
Member

@vaintroub vaintroub commented Nov 19, 2025

  • The Jira issue number for this PR is: MDEV-38029

Description

The test fails for TZ values such as PST8PDT (present but outdated in tzdb) and custom forms like GST-1GDT. On musl, these values do not trigger the expected DST transitions, leading to incorrect DST offsets or abbreviations.
This appears to be a musl libc bug; the same TZ values behave correctly elsewhere, including Windows. We work around it by skipping the affected tests when musl is detected.

Release Notes

Fixed unittest my_tzinfo-t to pass on musl based Linux distributions such as Alpine

How can this PR be tested?

Run the test on affected distro, like I did

desktop:~/xxx$ ./unittest/mysys/my_tzinfo-t
1..38
ok 1 # skip no test for default timezone name UTC
ok 2 - GMT offset is whole number of minutes 0
ok 3 - UTC: Offset for timestamp 1690000000 is 0/0
ok 4 - tz abbreviation UTC
ok 5 - GMT offset is whole number of minutes 0
ok 6 - UTC: Offset for timestamp 1700000000 is 0/0
ok 7 - tz abbreviation UTC
ok 8 - GMT offset is whole number of minutes 0
ok 9 - UTC: Offset for timestamp 1763552561 is 0/0
ok 10 - tz abbreviation UTC
ok 11 - PST8PDT: timezone_name = PDT
ok 12 # skip musl UTC offset/abbreviation bug, tzname PST8PDT, see MDEV-38029
ok 13 # skip musl UTC offset/abbreviation bug, tzname PST8PDT, see MDEV-38029
ok 14 # skip musl UTC offset/abbreviation bug, tzname PST8PDT, see MDEV-38029
ok 15 # skip musl UTC offset/abbreviation bug, tzname PST8PDT, see MDEV-38029
ok 16 # skip musl UTC offset/abbreviation bug, tzname PST8PDT, see MDEV-38029
ok 17 # skip musl UTC offset/abbreviation bug, tzname PST8PDT, see MDEV-38029
ok 18 - GMT: timezone_name = GMT
ok 19 - GMT: Summer GMT offset 0
ok 20 - GMT: Offset for timestamp 1690000000 is 0/0
ok 21 - GMT: Summer time abbreviation GMT
ok 22 - GMT: Winter GMT offset 0
ok 23 - GMT: Offset for timestamp 1700000000 is 0/0
ok 24 - GMT: Winter time abbreviation GMT
ok 25 - GST-1GDT: timezone_name = GDT
ok 26 # skip musl UTC offset/abbreviation bug, tzname GST-1GDT, see MDEV-38029
ok 27 # skip musl UTC offset/abbreviation bug, tzname GST-1GDT, see MDEV-38029
ok 28 # skip musl UTC offset/abbreviation bug, tzname GST-1GDT, see MDEV-38029
ok 29 # skip musl UTC offset/abbreviation bug, tzname GST-1GDT, see MDEV-38029
ok 30 # skip musl UTC offset/abbreviation bug, tzname GST-1GDT, see MDEV-38029
ok 31 # skip musl UTC offset/abbreviation bug, tzname GST-1GDT, see MDEV-38029
ok 32 - IST-5:30: timezone_name = IST
ok 33 - IST-5:30: Summer GMT offset 19800
ok 34 - IST-5:30: Offset for timestamp 1690000000 is 19800/19800
ok 35 - IST-5:30: Summer time abbreviation IST
ok 36 - IST-5:30: Winter GMT offset 19800
ok 37 - IST-5:30: Offset for timestamp 1700000000 is 19800/19800
ok 38 - IST-5:30: Winter time abbreviation IST
Test took 0.00 sec

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@vaintroub vaintroub requested a review from Copilot November 19, 2025 12:14
Copilot finished reviewing on behalf of vaintroub November 19, 2025 12:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes test failures in my_tzinfo-t on musl-based Linux distributions (such as Alpine) by working around a musl libc bug that incorrectly calculates DST transitions for certain timezone values.

  • Adds conditional skipping of 6 timezone offset/abbreviation tests when musl is detected and specific problematic TZ values are used
  • Skips tests for PST8PDT and GST-1GDT timezones which exhibit the bug on musl

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#if defined __linux__ && !defined __GLIBC__ && !defined __UCLIBC__
/*
MUSL incorrectly calculates UTC offsets and abbreviations
for certain values of TZ (DST related).See MDEV-38029
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after period. Should be "TZ (DST related). See MDEV-38029" instead of "TZ (DST related).See MDEV-38029".

Suggested change
for certain values of TZ (DST related).See MDEV-38029
for certain values of TZ (DST related). See MDEV-38029

Copilot uses AI. Check for mistakes.
The test fails for TZ values such as `PST8PDT` (present but outdated in
tzdb) and custom forms like `GST-1GDT`. On musl, these values do not
trigger the expected DST transitions, leading to incorrect DST offsets
or abbreviations.

This appears to be a musl libc bug; the same TZ values behave correctly
elsewhere, including Windows. We work around it by skipping the
affected tests when musl is detected.
@OldManYellsAtCloud
Copy link

For what my comment's worth, this patch works for me, thanks a lot.
(I reported the issue)

@grooverdan grooverdan enabled auto-merge (rebase) November 20, 2025 00:31
@grooverdan grooverdan merged commit a61a746 into 11.4 Nov 20, 2025
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants