Bug#1001774: tm_isdst=1 with mktime produces unexpected output

2021-12-20 Thread Aurelien Jarno
On 2021-12-20 09:06, Daniel McDonald wrote:
> Dear Aurelian,
> 
> I can confirm that changing the timezone within Ubuntu 20.04 through Github 
> Actions resolves the bug. The default set timezone is “Etc/UTC” as reported 
> by “timedatectl”. Setting to “America/Los_Angeles” with “timedatectl” allows 
> for a passing workflow. A link to the pass, with contextual information, can 
> be found here (note, this is under a fork of CPython where this behavior was 
> being investigated):
> 
> https://github.com/wasade/cpython/runs/4584894670?check_suite_focus=true#step:17:76
> 
> While this is reassuring, it seems the behavior is qualitatively different 
> across operating systems (or glibc versions). I’m unsure if that is expected. 
> As an example, we pass on Ubuntu 18.04 without changing the timezone:
> 
> https://github.com/wasade/cpython/runs/4585124128?check_suite_focus=true#step:14:43

Ubuntu 18.04 seems to run glibc 2.27. Versions of glibc older than 2.29
are affected by bug #23789 [1], and do not report any error if the date
is not representable. This is arguably a bug in Ubuntu 18.04, but this
behaviour is expected.

Regards,
Aurelien


[1] https://sourceware.org/bugzilla/show_bug.cgi?id=23789

-- 
Aurelien Jarno  GPG: 4096R/1DDD8C9B
aurel...@aurel32.net http://www.aurel32.net



Bug#1001774: tm_isdst=1 with mktime produces unexpected output

2021-12-16 Thread Aurelien Jarno
Hi,

On 2021-12-15 16:02, Daniel McDonald wrote:
> Package: glibc
> Version: 2.31
> 
> Use of mktime with tm_isdst=1 results in -1 indicating an error. This appears 
> unexpected, and cannot be replicated on OS X 11.6.1, Centos 7.9, Fedora 35, 
> Alpine or RHEL 8. The issue was first observed on Github Actions 
> ubuntu-latest (20.04). 
> 
> This issue was originally opened on the CPython bug tracker. They advised 
> opening a bug report with both Ubuntu and Debian. The original report with 
> CPython can be found here:
> 
> https://bugs.python.org/issue44413
> 
> An example C program follows at the end of the bug report, and can be 
> compiled with “gcc bug.c -o bug”. 
> 
> An example of execution of the bug, and failure, within a glibc 2.31 
> environment can be found here:
> 
> https://github.com/wasade/cpython/runs/4541212472?check_suite_focus=true#step:17:57
> 
> Thank you for your time. Please let me know if additional information would 
> be helpful. This is my first bug report to Debian. Though I reviewed the 
> guidance docs, I apologize in advance if I overlooked something.
> -Daniel
> 
> #include 
> #include 
> 
> void do_test() {
>   struct tm tm_works = { .tm_year=117,
>  .tm_mon=4,
>  .tm_mday=26,
>  .tm_hour=15,
>  .tm_min=30,
>  .tm_sec=16,
>  .tm_wday=4,
>  .tm_yday=145,
>  .tm_isdst=-1 };

In that structure, you define the DST to be unknown. It is therefore
left to mktime to decide if the current timezone was using DST or not at
that time.

>   struct tm tm_fails = { .tm_year=117,
>  .tm_mon=4,
>  .tm_mday=26,
>  .tm_hour=15,
>  .tm_min=30,
>  .tm_sec=16,
>  .tm_wday=4,
>  .tm_yday=145,
>  .tm_isdst=1 };

In that test, you specify that the DST was in effect. It is true for
some timezones like America/New_York or Europe/Berlin, but it is not
true for timezones like UTC or Japan/Tokyo.

Therefore your test depends on your timezone. Could you please share
your timezone configuration?

Note that depending on the timezone I choose, I can make the test to
work or fail on both Debian and Fedora.

Regards,
Aurelien

-- 
Aurelien Jarno  GPG: 4096R/1DDD8C9B
aurel...@aurel32.net http://www.aurel32.net