|
2001-04-05
| ||
| 06:56 | • Ticket [218705ffff] Bug in time_t handling on 64 bit Reliant UNIX status sti... artifact: a208aaa785 user: dgp | |
|
2000-10-26
| ||
| 08:27 | • Closed ticket [218705ffff]. artifact: e74d85934d user: welch | |
| 01:04 | • New ticket [218705ffff]. artifact: 8beb6044b5 user: nobody | |
Bug in time_t handling on 64 bit Reliant UNIX
Closed / Fixed218705ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:04:23
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
welch Closed ticket [218705ffff].
[History diff]2000-10-26 08:27:12
dgp Ticket [218705ffff]: 3 changes
[History diff]2001-04-05 06:56:33
Log in (anonymous is fine) to add a comment.