Overview
| Artifact ID: | 3da5c21232cfd5d458d5386e7ed5a21ee16ab831 |
|---|---|
| Ticket: | 2176669fffffffffffffffffffffffffffffffff
Strange seek bug |
| User & Date: | nobody on 2008-10-18 11:57:20 |
Changes
- assignee changed to: "andreas_kupries"
- cmimetype changed to: "text/plain"
- comment changed to:
I've got strange seek behavior executing this simple script (Windows XP, tcl 8.4.19/8.5.2/8.6a1): --- exp.tcl --- set fd [open hash.db r+] seek $fd 100 puts [tell $fd] puts -nonewline $fd 0 puts [tell $fd] read $fd 2 seek $fd 0 puts [tell $fd] --- Result is: 100 101 error during seek on "filea3bf40": bad address in system call argument while executing "seek $fd 0" (file "exp.tcl" line 8) ------------ It seems that it originates from here: ----- tclIO.c ----- ... In Tcl_Seek: /* * Compute how much input and output is buffered. If both input and output * is buffered, cannot compute the current position. */ inputBuffered = Tcl_InputBuffered(chan); outputBuffered = Tcl_OutputBuffered(chan); if ((inputBuffered != 0) && (outputBuffered != 0)) { Tcl_SetErrno(EFAULT); return Tcl_LongAsWide(-1); } -------- So, [flush]-ing channel before seeking helps. I didn't find this documented anywhere. Moreover, as Alexandre Ferrieux said, [seek] is documented to flush the output side. - foundin changed to: "obsolete: 8.4.19"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "25. Channel System"
- title changed to: "Strange seek bug"
- type changed to: "Bug"