Artifacts Associated With Ticket 5adc3506834c2aac
Ticket change [338473289a] (rid 140438) by wish72 on 2014-10-26 04:58:04:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
My program repeats attempts to read file after EOF condition appeared on it. The program looks for any new lines appended to that file. The program works with Tcl 8.5, but it doesn't see any new lines with Tcl 8.6. Here's the test: $ cat read-after-eof.tcl puts "Tcl patchlevel: [info patchlevel]" set h [open ./read-after-eof.txt] read $h set text [clock seconds] exec cat >>./read-after-eof.txt << $text puts "gets after EOF returns: '[gets $h]'" $ echo "" >read-after-eof.txt $ /opt/ActiveTcl-8.5/bin/tclsh read-after-eof.tcl Tcl patchlevel: 8.5.15 gets after EOF returns: '1414267142' $ echo "" >read-after-eof.txt $ /opt/ActiveTcl-8.6/bin/tclsh read-after-eof.tcl Tcl patchlevel: 8.6.2 gets after EOF returns: ''
- foundin initialized to: "8.6.2"
- is_private initialized to: "0"
- login: "wish72"
- priority initialized to: "5 Medium"
- private_contact initialized to: "50e83720d6a6ab957a346d2afa6925def62d4f1e"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "wish72"
- subsystem initialized to: "16. Commands A-H"
- title initialized to:
'gets' repeated after EOF in Tcl 8.6.2 doesn't work
- type initialized to: "Bug"
Ticket change [08c9908eeb] (rid 140444) by dgp on 2014-10-26 19:00:16:
- assignee changed to: "dgp"
- icomment:
You will find the same results in 8.5.16 and 8.6.17. A reworking of I/O leading up to 8.5.16 and 8.6.2 included as one of its premises that "EOF" means "end of any new bytes to be read from this channel". There a number of reasons for this, which I won't go into in detail right at the moment. (Better to be correct than to be quick.) While I ponder the use case in this ticket and whether and how it might prompt an effort to recover what it desires, I can at least offer a way to accomplish what is desired. Between the [exec cat....] and the final [puts ...] commands in the demo script above, insert this command: seek $h 0 current The resulting modified script should work as you wish in all new and old Tcl interps.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "7 High"
- title changed to: "'gets' repeated after EOF doesn't work"
Ticket change [06d753c079] (rid 140445) by dgp on 2014-10-26 19:01:23:
- icomment:
> You will find the same results in 8.5.16 and 8.6.17. That should refer to 8.5.16 and 8.5.17.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [5170d988c9] (rid 140457) by dgp on 2014-10-28 20:11:58:
- icomment:
See bug-5adc350683 branch for work in progress restoring the capability, as well as addressing what the non-permanence of EOF on a read channel means for things like channel stacks and transformations.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [f3b818391c] (rid 140469) by dgp on 2014-10-29 20:34:09:
- icomment:
The key routine here is GetInput(). Every caller of GetInput() has to (when otherwise warranted) make at least one call to GetInput() -- even if EOF is already set on the channel -- in order to enable the moving past EOF, and reading whatever new data may be available now. On the other hand, every caller of GetInput() must not make an additional call to GetInput() after a call to GetInput() has left EOF set in the channel. As soon as a call to GetInput() leaves EOF set in the channel, the caller must be on a path to return to its caller without calling GetInput() again. This must be achieved so that a fleeting EOF condition is not missed by the caller. There are 4 callers of GetInput(): TclGetsObjBinary(), FilterInputBytes(), DoReadChars(), and DoRead().
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [585876b683] (rid 140575) by dgp on 2014-11-06 16:38:18:
- closedate changed to: "2456968.19326843"
- closer changed to: "dgp"
- icomment:
Fix committed for 8.5.18 and 8.6.3.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"