Artifacts Associated With Ticket 218382
Ticket change [2cd8cd4a38] (rid 118980) by nobody on 2000-10-26 00:56:55:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 4404 Bug Version: 8.3 SubmitDate: '2000-03-20' LastModified: '2000-03-27' Severity: SER Status: Closed Submitter: techsupp ChangedBy: hobbs OS: All Unix OSVersion: not OS version specific FixedDate: '2000-10-25' ClosedDate: '2000-03-27' Name: Huver Hu ReproducibleScript: On nearly all Unices, strftime() is documented that "when it returns zero, the buffer content is indeterminate". FormatClock() does not deal with this properly. DesiredBehavior: see short diff attached. Patch: *** tclClock.c.old Tue Jan 25 21:37:40 2000 --- tclClock.c Mon Mar 20 00:49:37 2000 *************** *** 340,349 **** tzset(); } #endif ! if ((result == 0) && (*format != '\0')) { ! Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad format string \"", format, "\"", (char *) NULL); ! return TCL_ERROR; } Tcl_SetStringObj(Tcl_GetObjResult(interp), buffer.string, -1); --- 340,354 ---- tzset(); } #endif ! if (result == 0) { ! /* if strftime() returns 0, the buffer content is indeterminate */ ! if (*format != '\0') { ! Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad format string \"", format, "\"", (char *) NULL); ! Tcl_DStringFree(&buffer); ! return TCL_ERROR; ! } ! Tcl_DStringSetLength(&buffer, 0); } Tcl_SetStringObj(Tcl_GetObjResult(interp), buffer.string, -1); PatchFiles: generic/tclClock.c The current code is actually correct, because strftime actually returns the number of chars written, and that will be zero when format is "". The check for empty format was moved up though, to avoid the extra code. -- 03/27/2000 hobbs - foundin initialized to: "obsolete: 8.3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "FormatClock() mis-handles strftime() retrun"
- type initialized to: "Bug"
Ticket change [e6b422dd67] (rid 104336) by welch on 2000-10-26 08:21:16:
- closedate changed to: "2000-10-26T01:21:16"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [9fafa5610e] (rid 96682) by dgp on 2001-04-20 02:00:08:
- closedate changed to: "2001-04-19T19:00:08"
- closer changed to: "dgp"
- subsystem changed to: "06. Time Measurement"