Skip to content
Prev 52686 / 63424 Next

segfault with POSIXlt zone=NULL zone=""

On Tue, Dec 6, 2016 at 6:37 AM, <frederik at ofb.net> wrote:
If you're asking about a bug in R, you should provide a *minimal*
reproducible example (i.e. one without any package dependencies).
This has nothing to do with lubridate, so you can reproduce the
behavior with:

d <- as.POSIXlt(Sys.time())
d$zone <- NULL
d$zone <- ""
d
You are.  You're changing the internal structure of a POSIXlt object
by re-ordering the list elements.  You should not expect a malformed
POSIXlt object to behave as if it's correctly formed.  You can see
it's malformed by comparing it's unclass()'d output.

d <- as.POSIXlt(Sys.time())
unclass(d)  # valid POSIXlt object
d$zone <- NULL
d$zone <- ""
unclass(d)  # your malformed POSIXlt object