On Aug 3 03:54, Michael Enright wrote: > On Mon, Aug 3, 2015 at 1:36 AM, Corinna Vinschen wrote: > > > > The core thingy in POSIX is "The header shall declare the tm > > structure, which shall include at least the following members:" > > ^^^^^^^^ > > I saw this language myself. > > > > > A conforming application does not use such a structure which isn't > > *at least* initialized to all 0 (memset). > > > > I did NOT see any language that said anything about doing that. In any > case, the code I'm using is in another Cygwin package, libmozjs185. When having more members in a structure than defined as the minimum set by POSIX, there's no way around that. > > If your executable has been built prior to releasing this new code, > > Cygwin won't require tm_zone and tm_gmtoff anyway. > > I have no idea how to interpret "has been build prior" in this case. prior to the Cygwin version introducing the new members. Same problem as in Glibc. > > However, for later > > built executables it will, and then there's no way around the crash > > if tm_zone is uninitialized. If it's NULL, you'll get the current > > timezone. But if it's not NULL it's suppsoed to be a pointer to > > a valid string. How is a library supposed to know that the pointer > > value is just garbage? > > In the case where the spec does not say anything except the members > shall include at least so-and-so, the library probably ought not to > assume that it gets its implementation-defined members defined as > inputs. > [...] Hang on. So you suggest that Glibc, Cygwin, as well as any other implementation based on the localtime.c code from Arthur David Olson, stop using the additional struct members? Despite them doing the right thing where the POSIX implementation is lacking? Because there's one lib you need which doesn't work as expected, rather than rebuilding it with a matching fix? That doesn't sound overly convincing to me. Other than that, you didn't answer the question: How is a library supposed to know that the non-NULL pointer value is just garbage? I'm firmly with the GLibc guys here... Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat