From m@ech|er @end|ng |rom @t@t@m@th@ethz@ch  Tue Oct 11 10:28:48 2022
From: m@ech|er @end|ng |rom @t@t@m@th@ethz@ch (Martin Maechler)
Date: Tue, 11 Oct 2022 10:28:48 +0200
Subject: [Rd] A potential POSIXlt->Date bug introduced in r-devel
In-Reply-To: <CABzLhzynMazG7dVfr+GC_3F=QDEJK+zx4AX_tz-2CdbJdYvv=w@mail.gmail.com>
References: <CABzLhzzsnRCwM3LPM-z2T8YFO3bBcD7=iE3Hxx9rLdEUeAkk3g@mail.gmail.com>
 <25406.36513.13316.676488@stat.math.ethz.ch>
 <25408.8433.260821.451226@stat.math.ethz.ch>
 <CABzLhzynMazG7dVfr+GC_3F=QDEJK+zx4AX_tz-2CdbJdYvv=w@mail.gmail.com>
Message-ID: <25413.10560.448520.766218@stat.math.ethz.ch>

>>>>> Davis Vaughan 
>>>>>     on Fri, 7 Oct 2022 11:00:23 -0400 writes:

    > Martin,
    > FWIW, I scoured the docs using GitHub's new code search preview but can't
    > seem to find any reference to the fact that POSIXlt fields are internally
    > recycled (even though lubridate seems to have been relying on this for
    > quite some time).

Thank you, Davis, for searching  and confirming that this has
never been documented.  And so,  in that sense there's no bug,
because only non-documented behaviour has changed.

Still, with svn rev 83062  I have finally committed a version of
the C code underlying  as.Date.POSIXlt()  which (I think/hope)
does deal correctly with such partially filled POSIXlt objects
(it does with your relatively benign example and with the more
 nasty one I had mentioned).

BTW,  at least length() has been working correctly for
these, for a bit less than a day now, too,  since svn rev 83056  .

These are still only some of several steps to correctly support
such objects.
Notably the `[` and  `[<-` methods will need a substantial
update, too (as you have noticed for the latter in your other
R-devel post on Oct 6, Subject "Bug with `[<-.POSIXlt` on specific OSes").

Note that I'd be quite grateful for well documented platform
dependent behavior.  In addition to a typical sessionInfo() this
would also need to report the current setting of a  "TZ" environment variable,
where I have noticed [on Linux, Fedora 36] that there may be
different behavior between TZ entirely undefined and a TZ="" setting
(which I intuitively assumed would work equivalently).


Best,
Martin


    > -Davis

    > On Fri, Oct 7, 2022 at 8:52 AM Martin Maechler <maechler at stat.math.ethz.ch>
    > wrote:

    >> >>>>> Martin Maechler
    >> >>>>>     on Thu, 6 Oct 2022 10:15:29 +0200 writes:
    >> 
    >> >>>>> Davis Vaughan
    >> >>>>>     on Wed, 5 Oct 2022 17:04:11 -0400 writes:
    >> 
    >> >> Hi all,
    >> 
    >> >> I think I have discovered a bug in the conversion from POSIXlt to
    >> Date that has been introduced in r-devel.
    >> 
    >> >> It affects lubridate, but surprisingly didn't cause test failures
    >> there.

   [..................]



[Rd] A potential POSIXlt->Date bug introduced in r-devel
Martin Maechler