Artifacts Associated With Ticket 491341ffffffffffffffffffffffffffffffffff
Ticket change [f39f7d1218] (rid 129744) by dgp on 2001-12-10 22:31:37:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- comment initialized to:
When Tcl_GetsObj(chan, obj) receives an obj that already has a non-empty string rep, the bytes read from chan are supposed to be appended to the existing string rep. It is incorrect to assume that obj->bytes is an empty string. Tcl_GetsObj() gets this right almost everywhere, but this part of the spec was forgotten in lines 3634-3644 of tclIO.c, where EOF handling takes place. Those lines only work if obj->bytes passed in is an empty string. Since [gets] always does pass in such an empty Tcl_Obj, this bug isn't visible at the script level, but it shows up regularly in the call at line 300 of tclMain.c. Lines 304-306 of tclMain.c even appear to be an awkward attempt to work around this bug, without ever identifying it as a bug. To demo the bug, create a file test.tcl with a single line: if 1 { Then at a shell prompt $ tclsh < test.tcl This will stick tclsh in an infinite loop. Attached is the simple patch that correctly tests for "no characters read @ EOF" when obj-> bytes is non-empty. - foundin initialized to: "obsolete: 8.4a4"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "25. Channel System"
- title initialized to: "GetsObj: trunc/append confusion @EOF "
- type initialized to: "Bug"
Ticket change [4d052c3e85] (rid 126993) by dgp on 2001-12-11 05:31:38:
- icomment:
File Added - 14473: getsobj.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [496b65ee4a] (rid 100049) by andreas_kupries on 2001-12-11 08:56:03:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=75003 Sorry, but I cannot accept the patch yet. Here is the list of tests that fail for me (configure --disable-shared, linux 2.2.19, glibc 2.1.3) after applying the patch (I removed all failing tests which failed without the patch applied): compile-13.1 testing underestimate of maxStackSize in list cmd FAILED exec-16.2 flush output before exec FAILED io-6.12 Tcl_GetsObj: lf mode: lone \r FAILED io-6.13 Tcl_GetsObj: lf mode: 1 char FAILED io-6.15 Tcl_GetsObj: lf mode: several chars FAILED io-6.17 Tcl_GetsObj: cr mode: lone \n FAILED io-6.19 Tcl_GetsObj: cr mode: 1 char FAILED io-6.21 Tcl_GetsObj: cr mode: several chars FAILED io-6.23 Tcl_GetsObj: crlf mode: lone \n FAILED io-6.25 Tcl_GetsObj: crlf mode: \r\r FAILED io-6.27 Tcl_GetsObj: crlf mode: 1 char FAILED io-6.29 Tcl_GetsObj: crlf mode: several chars FAILED io-6.40 Tcl_GetsObj: auto mode: 1 char FAILED io-6.42 Tcl_GetsObj: auto mode: several chars FAILED io-6.43 Tcl_GetsObj: input saw cr FAILED io-6.44 Tcl_GetsObj: input saw cr, not followed by cr FAILED io-6.49 Tcl_GetsObj: auto mode: \r followed by \n FAILED io-6.50 Tcl_GetsObj: auto mode: \r not followed by \n FAILED io-6.51 Tcl_GetsObj: auto mode: \n FAILED io-6.54 Tcl_GetsObj: device EOF FAILED io-30.21 Tcl_Write, ^Z in middle ignored, Tcl_Read cr FAILED io-30.22 Tcl_Write, ^Z in middle ignored, Tcl_Read crlf FAILED io-31.5 Tcl_Write lf, Tcl_Gets cr FAILED io-31.6 Tcl_Write lf, Tcl_Gets crlf FAILED io-31.8 Tcl_Write cr, Tcl_Gets lf FAILED io-33.6 Tcl_Gets and end of file FAILED
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
Add attachment "getsobj.patch" [6fe4307857] (rid 100391) by dgp on 2001-12-13 05:03:39.
Ticket change [3bdc9598c4] (rid 112821) by dgp on 2001-12-13 05:03:39:
- assignee changed to: "andreas_kupries"
- icomment:
Logged In: YES user_id=80530 Here's the corrected patch. Passes all tests.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [680897fa85] (rid 102996) by dgp on 2001-12-13 05:03:40:
- icomment:
File Deleted - 14473: File Added - 14587: getsobj.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [8a4b9c1dca] (rid 127368) by andreas_kupries on 2001-12-13 05:29:37:
- icomment:
Logged In: YES user_id=75003 Confirmed passing of all tests for linux.
- login: "andreas_kupries"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- username: "andreas_kupries"
- icomment:
Ticket change [23832e065e] (rid 130953) by andreas_kupries on 2001-12-13 05:33:05:
- closedate changed to: "2001-12-12T22:33:05"
- closer changed to: "andreas_kupries"
- icomment:
Logged In: YES user_id=75003 Committed to head.
- login: "andreas_kupries"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "andreas_kupries"