Branch: refs/heads/maint-5.42
  Home:   https://github.com/Perl/perl5
  Commit: 9dce4787ecf375b3b434e36c28ad6fc052c12818
      
https://github.com/Perl/perl5/commit/9dce4787ecf375b3b434e36c28ad6fc052c12818
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M ext/POSIX/t/posix.t

  Log Message:
  -----------
  posix.t: Properly populate optional fields to strtime

The next commits that fix some bugs showed these were not properly
getting initialized.

(cherry picked from commit aaaad57879ff127415f470d6c29777a696e97459)


  Commit: a3a6763d0e656d62b10b570ead5fa7c77e2f2600
      
https://github.com/Perl/perl5/commit/a3a6763d0e656d62b10b570ead5fa7c77e2f2600
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Silence unused variable compiler warning

On some systems this was unused.  Now that we have C99, we can move the
declaration and some #ifdef's and not declare it unless it is going to
be used.

(cherry picked from commit 323d85c86c657bb81983b0057d2310c52642797d)


  Commit: 82ace4467b92f48c4a7b4137f0ddd7e3673c5cf5
      
https://github.com/Perl/perl5/commit/82ace4467b92f48c4a7b4137f0ddd7e3673c5cf5
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Slight comment clarification

(cherry picked from commit fae271acf4c75ba128115435bbc0ab50c3d69cf3)


  Commit: b62ff81707d991558398f52d2aa4b11850360b4e
      
https://github.com/Perl/perl5/commit/b62ff81707d991558398f52d2aa4b11850360b4e
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: ints_to_tm: Fix #if's

tl;dr:

Fixes GH #23878

I botched this in Perl 5.42.  These conditional compilation statements
were just plain wrong, causing code to be skipped that should have been
compiled.  It only affected the few hours of the year when daylight
savings time is removed, so that the hour value is repeated.  We didn't
have a good test for that.

gory details:

libc uses 'struct tm' to hold information about a given instant in
time, containing fields for things like the year, month, hour, etc.  The
libc function mktime() is used to normalize the structure, adjusting,
say, an input Nov 31 to be Dec 01.

One of the fields in the structure, 'is_dst', indicates if daylight
savings is in effect, or whether that fact is unknown.  If unknown,
mktime() is supposed to calculate the answer and to change 'is_dst'
accordingly.  Some implementations appear to always do this calculation
even when the input value says the result is known.  Others appear to
honor it.

Some libc implementations have extra fields in 'struct tm'.

Perl has a stripped down version of mktime(), called mini_mktime(),
written by Larry Wall a long time ago.  I don't know why.  This crippled
version ignores locale and daylight time.  It also doesn't know about
the extra fields in 'struct tm' that some implementations have.  Nor can
it be extended to know about those fields, as they are dependent on
timezone and daylight time, which it deliberately doesn't consider.

The botched #ifdef's were supposed to compensate for both the extra
fields in the struct and that some libc implementations always
recalculate 'is_dst'.

On systems with these fields, the botched #if's caused only
mini_mktime() to be called.  This meant that these extra fields didn't
get populated, and daylight time is never considered to be in effect.
And 'is_dst' does not get changed from the input.

On systems without these fields, the regular libc mktime() would be
called appropriately.

The bottom line is that for the portion of the year when daylight
savings is not in effect, that portion worked properly.  The two extra
fields would not be populated, so if some code were to read them, it
would only get the proper values by chance.  We got no reports of this.
I attribute that to the fact that the use of these is not portable, so
code wouldn't tend to use them.  There are portable ways to access the
information they contain.

Tests were failing for the portions of the year when daylight savings is
in effect; see GH #22351.  The code looked correct just reading it (not
seeing the flaw in the #ifdef's), so I assumed that it was an issue in
the libc implementations and instituted a workaround.  (I can't now
think of a platform where there hasn't been a problem with a libc with
something regarding locales, so that was a reasonable assumption.)

Among other things (fixed in the next commit), that workaround overrode
the 'is_dst' field after the call to mini_mktime(), so that the value
actually passed to libc strftime() indicated that daylight is in effect.

What happens next depends on the libc strftime() implementation.  It
could conceivably itself call mktime() which might choose to override
is_dst to be the correct value, and everything would always work.  The
more likely possibility is that it just takes the values in the struct
as-is.  Remember that those values on systems with the extra fields were
calculated as if daylight savings wasn't in effect, but now we're
telling strftime() to use those values as if it were in effect.  This
is a discrepancy.  I'd have to trace through some libc implementations
to understand why this discrepancy seems to not matter except at the
transition time.

But the bottom line is this commit removes that discrepancy, and causes
mktime() to be called appropriately on systems where it wasn't, so
strftime() should now function properly.

(cherry picked from commit 63a16623780f2704009d0b7a5ed4e7f35230c392)


  Commit: 95a6ebda4042db6716fe6daffe745020223d2c5c
      
https://github.com/Perl/perl5/commit/95a6ebda4042db6716fe6daffe745020223d2c5c
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  my_strftime(): Properly take daylight savings into account

Because of the bug fixed in the previous commit, this function was
changed in 5.42 to have a work around, which is no longer needed.

(cherry picked from commit c85683700affe3e6b2d93a127c2a40092bacc513)


  Commit: 3a828c0f51971eafa9b4c56bbc4ed273d22d2be1
      
https://github.com/Perl/perl5/commit/3a828c0f51971eafa9b4c56bbc4ed273d22d2be1
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M ext/POSIX/POSIX.xs
    M ext/POSIX/lib/POSIX.pm

  Log Message:
  -----------
  POSIX.xs: Properly take daylight savings into account

Because of the bug fixed two commits ago, this function was changed in
5.42 to have a work around, which is no longer needed.

(cherry picked from commit fe93cfc3c5837dc63888ff4c767481f2fce9f48f)


  Commit: 351f61f9dff7d545c4a5d969e00b9e67fc06083a
      
https://github.com/Perl/perl5/commit/351f61f9dff7d545c4a5d969e00b9e67fc06083a
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M ext/POSIX/t/time.t

  Log Message:
  -----------
  POSIX/t/time.t: Extract common code to single place

(cherry picked from commit 6ffc00a3aa30b9fd7136dae91b2262dad1460d4e)


  Commit: 398f4d34b779c42576cf169811bf54d435e22520
      
https://github.com/Perl/perl5/commit/398f4d34b779c42576cf169811bf54d435e22520
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M ext/POSIX/t/time.t

  Log Message:
  -----------
  POSIX/t/time.t: tzset() works on Windows; not MingW

I ran some experiments, and found that tzset works on Windows, and is
required after changing the TZ environment variable from within perl.

But it did not work on MingW.  Maybe there is something else needed in
the Posix module that would get it to work; I didn't investigate

The only way I could figure out how to distinguish in Perl space between
MSVC and MingW was looking at the make command.  Maybe there is a better
way

(cherry picked from commit 220368d14b8434f7cc57d126021a719fe220b030)


  Commit: 278dfeb2601034e558bc79c4298c896e40256db7
      
https://github.com/Perl/perl5/commit/278dfeb2601034e558bc79c4298c896e40256db7
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M ext/POSIX/lib/POSIX.pod
    M locale.c

  Log Message:
  -----------
  perlapi: Add extensive strftime documentation

Due to the differences in various systems' implementations, I think it
is a good idea to more fully document the vagaries I have discovered,
and how perl resolves them.

(cherry picked from commit c82acdef79201d5073fd2c343f946d1a7f4ca8b5)


  Commit: f19d2c340c0674de375c5a5a6f9569a59d7b714b
      
https://github.com/Perl/perl5/commit/f19d2c340c0674de375c5a5a6f9569a59d7b714b
  Author: Karl Williamson <[email protected]>
  Date:   2026-01-25 (Sun, 25 Jan 2026)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta for GH #23878

(cherry picked from commit 9819d7a910b501a52bc913463e4315b345a576d5)


Compare: https://github.com/Perl/perl5/compare/7f16c10de326...f19d2c340c06

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to