Subject: Tcl bug on NetBSD
To: <>
From: Bruce Albrecht <Bruce.Albrecht-1@tc.umn.edu>
List: netbsd-help
Date: 02/21/1996 15:28:47
The following message is a courtesy copy of an article
that has been posted as well.
Tcl fails several tests on NetBSD because the stat function returns a
64 bit value instead of a 32 bit value. Several people have been
asking about this in the NetBSD mailing lists, so I thought I ought to
post my patch. It's really the same code that I mailed to the NetBSD
mailing lists, but I've changed it to a context diff.
I've only compiled and tested this for tcl 7.4p3, but I figure the tcl
folks are more interested in a 7.5b1 patch.
for tcl7.5b1:
diff tclUnixAZ.c~ tclUnixAZ.c
*** tclUnixAZ.c~ Wed Feb 21 15:00:43 1996
--- tclUnixAZ.c Wed Feb 21 15:12:37 1996
***************
*** 680,686 ****
if (stat(fileName, &statBuf) == -1) {
goto badStat;
}
! sprintf(interp->result, "%ld", statBuf.st_size);
goto done;
} else if ((c == 's') && (strncmp(argv[1], "stat", length) == 0)
&& (length >= 2)) {
--- 680,686 ----
if (stat(fileName, &statBuf) == -1) {
goto badStat;
}
! sprintf(interp->result, sizeof(statBuf.st_size)==8 ? "%qd" : "%ld", statBuf.st_size);
goto done;
} else if ((c == 's') && (strncmp(argv[1], "stat", length) == 0)
&& (length >= 2)) {
sprintf(interp->result, "%ld", statBuf.st_size);
for tcl7.4p3:
*** tclUnixAZ.c.orig Wed Feb 21 15:19:25 1996
--- tclUnixAZ.c Wed Feb 21 15:20:22 1996
***************
*** 686,692 ****
if (stat(fileName, &statBuf) == -1) {
goto badStat;
}
! sprintf(interp->result, "%ld", statBuf.st_size);
goto done;
} else if ((c == 's') && (strncmp(argv[1], "stat", length) == 0)
&& (length >= 2)) {
--- 686,692 ----
if (stat(fileName, &statBuf) == -1) {
goto badStat;
}
! sprintf(interp->result, sizeof(statBuf.st_size)==8 ? "%qd" : "%ld", statBuf.st_size);
goto done;
} else if ((c == 's') && (strncmp(argv[1], "stat", length) == 0)
&& (length >= 2)) {