Re: [pgsql-hackers-win32] [HACKERS] win32 crash in initdb
"Magnus Hagander" <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.devel.patches,gmane.comp.db.postgresql.devel.win32 |
|---|---|
| Message-ID | <[email protected]> |
>> The crash people are getting in initdb is due to the 1.19 revision to
>> pgtz.c. Not sure why yet...looking into it...
>
>Unfortunate behavior when probing pre-1970 dates, maybe?
Indeed that was the problem. Attached patch fixes the issue here and for
Merlin :-)
I've also figured out why it always worked for me. When in the western
europe timezone, the bug does not show up (probably because we don't
probe those dates). When I set my system to US Eastern, it broke.
//Magnus
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [email protected] so that your
message can get through to the mailing list cleanly
tzfix.patch
(application/octet-stream, 914 B)
Index: timezone/pgtz.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/timezone/pgtz.c,v
retrieving revision 1.19
diff -c -r1.19 pgtz.c
*** timezone/pgtz.c 22 Jul 2004 05:28:30 -0000 1.19
--- timezone/pgtz.c 29 Jul 2004 17:00:17 -0000
***************
*** 182,187 ****
--- 182,189 ----
if (!pgtm)
return -1; /* probably shouldn't happen */
systm = localtime(&(tt->test_times[i]));
+ if (!systm)
+ return -1;
if (!compare_tm(systm, pgtm))
{
elog(DEBUG4, "TZ \"%s\" scores %d: at %ld %04d-%02d-%02d %02d:%02d:%02d %s versus %04d-%02d-%02d %02d:%02d:%02d %s",
***************
*** 302,307 ****
--- 304,311 ----
for (t = tnow; t <= tnow + T_MONTH * 14; t += T_MONTH)
{
tm = localtime(&t);
+ if (!tm)
+ continue;
if (tm->tm_isdst < 0)
continue;
if (tm->tm_isdst == 0 && std_zone_name[0] == '\0')