pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/40954: lang/smlnj broken with 64-bit time_t



>Number:         40954
>Category:       pkg
>Synopsis:       lang/smlnj broken with 64-bit time_t
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 04 06:15:00 +0000 2009
>Originator:     David A. Holland
>Release:        NetBSD 5.99.7 (20090209) pkgsrc 20090213
>Organization:
>Environment:
System: NetBSD tanaqui 5.99.7 NetBSD 5.99.7 (TANAQUI) #24: Mon Feb 9 11:19:51 
EST 2009 root@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386
>Description:

smlnj blows up during the build with uncaught time exceptions.
Needless to say, the build then doesn't actually stop on error but
keeps sputtering along for a while. smlnj seems to have a really
particularly Special build system.

At least part of the problem is that they apparently saw fit to make
up their own private time structure and pass it to gettimeofday().

>How-To-Repeat:

make

>Fix:

Find someone who cares enough to wade into it?

The following might be taken as a starting point, but doesn't by any
means fully fix the problem, or fix all the problems, or something
like that.


--- src/runtime/gc/gc-stats.h.orig      2009-03-03 18:23:38.000000000 -0500
+++ src/runtime/gc/gc-stats.h   2009-03-03 18:25:04.000000000 -0500
@@ -16,6 +16,7 @@ extern void ReportVM (ml_state_t *msp, i
 
 #define START_GC_PAUSE(HEAP)   {                                       \
        if (StatsOn) {                                                  \
+           struct timeval tv;                                          \
            heap_t          *__heap = (HEAP);                           \
            stat_rec_t      *__p = &(StatsBuf[NStatsRecs]);             \
            Unsigned32_t    __n = (Addr_t)(msp->ml_allocPtr) -          \
@@ -23,7 +24,10 @@ extern void ReportVM (ml_state_t *msp, i
            CNTR_INCR(&(__heap->numAlloc), __n);                        \
            __p->allocCnt = __heap->numAlloc;                           \
            __p->numGens = 0;                                           \
-           gettimeofday(&(__p->startTime), NIL(struct timezone *));    \
+           gettimeofday(&tv, NIL(struct timezone *));                  \
+           /* XXX breaks in 2038 */                                    \
+           __p->startTime.seconds = tv.tv_sec;                         \
+           __p->startTime.uSeconds = tv.tv_usec;                       \
        }                                                               \
     }
 
@@ -34,8 +38,11 @@ extern void ReportVM (ml_state_t *msp, i
 
 #define STOP_GC_PAUSE()                        {                               
\
        if (StatsOn) {                                                  \
-           gettimeofday(&(StatsBuf[NStatsRecs].stopTime),              \
-               NIL(struct timezone *));                                \
+           struct timeval tv;                                          \
+           gettimeofday(&tv, NIL(struct timezone *));                  \
+           /* XXX breaks in 2038 */                                    \
+           StatsBuf[NStatsRecs].stopTime.seconds = tv.tv_sec;          \
+           StatsBuf[NStatsRecs].stopTime.uSeconds = tv.tv_usec;        \
            STATS_FINISH();                                             \
        }                                                               \
     }


--- src/runtime/gc/init-gc.c.orig       2009-03-03 18:15:36.000000000 -0500
+++ src/runtime/gc/init-gc.c    2009-03-03 18:17:03.000000000 -0500
@@ -218,12 +218,16 @@ void InitHeap (ml_state_t *msp, bool_t i
 #if defined(COLLECT_STATS)
     if (StatsFD > 0) {
        stat_hdr_t      hdr;
+       struct timeval  tv;
        CNTR_ZERO(&(heap->numAlloc));
        hdr.mask = STATMASK_ALLOC|STATMASK_NGENS|STATMASK_START|STATMASK_STOP;
        hdr.isNewRuntime = 1;
        hdr.allocSzB = params->allocSz;
        hdr.numGens = params->numGens;
-       gettimeofday (&(hdr.startTime), NIL(struct timezone *));
+       gettimeofday (&tv, NIL(struct timezone *));
+       /* XXX breaks in 2038 */
+       hdr.startTime.seconds = tv.tv_sec;
+       hdr.startTime.uSeconds = tv.tv_usec;
        write (StatsFD, (char *)&hdr, sizeof(stat_hdr_t));
     }
 #endif



Home | Main Index | Thread Index | Old Index