Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8beb6044b510bda58699ba489997d3d8433dcf0d
Ticket: 218705ffffffffffffffffffffffffffffffffff
Bug in time_t handling on 64 bit Reliant UNIX
User & Date: nobody on 2000-10-26 01:04:23
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1806 Bug
    Version: 8.1b3
    SubmitDate: '1999-04-14'
    LastModified: '2000-01-12'
    Severity: SER
    Status: Released
    Submitter: pat
    ChangedBy: hobbs
    OS: Other
    OSVersion: ReliantUNIX-N 5.44C10
    Machine: NA
    FixedDate: '2000-01-12'
    FixedInVersion: 8.3b2
    ClosedDate: '2000-10-25'
    
    
    Name:
    Andrej Borsenkow
    
    CustomShell:
    I added block to configure.in to recognise ReliantUNIX for dynamic loading. The CFLAGS were set to enable 64 bit compile mode.
    
    ReproducibleScript:
    I've done a test drive for compiling Tcl 8.1b3 on ReliantUNIX (formerly
        SINIX) in 64 bit mode on MIPS R4400. The clock tests partially failed.
        At least in some cases the reason was wrong handling of time_t
        variables.
    
        On our system in 64 bit mode sizeof(long) == 8, but sizeof(time_t) == 4
        (signed 32 bit value). The problem is, that FormatClock() gets unsigned
        long clockVal, than passes it by *reference* to TclpGetDate(), that
        converts pointers to clockVal to pointer to time_t. But in this case,
        only the first 4 bytes of clockVal are used; as ReliantUNIX is running
        in MSB mode, they are almost always zero.
    
        There is one more hidden bug here - the value of unsigned long can
        overflow time_t. It is hard to tell what to do - probably, Tcl should
        check for the largest possible value of time_t and return with an error
        if passed clockVal is too large.
    
    ObservedBehavior:
    clock command fails in most cases. Most of clock tests fail. Time/date
        manipulation is nearly impossible
    
    
    
    4/15/99 - redman - OK, why is time_t an int on ReliantUNIX?  This should probably be fixed anyway.
    --
    From Clevenger (for tclClock.c):
        /*
         * Pointer must point to a variable of type time_t for proper endian 
         * behavior. Cannot just caste address of clockVal.
         */
        tclockVal = (time_t) clockVal;
        timeDataPtr = TclpGetDate((time_t *) &tclockVal, useGMT);
    
    The noted problem, along with one similar occurrence in tclGetDate.y
    was fixed for 8.3b2.
    
    As for the potential overflow problem, one solution would be to check
    if sizeof(long) > sizeof(time_t), and use Tcl_GetIntFromObj if so.
    However, Tcl is only defined to work without standard POSIX parameters,
    which makes the overflow stuff undefined anyway. 
    -- 01/12/2000 hobbs
    
    
    
  4. foundin changed to: "obsolete: 8.1b3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "48. Number Handling"
  10. title changed to: "Bug in time_t handling on 64 bit Reliant UNIX"
  11. type changed to: "Bug"