Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f5c20f8f4ad0ed975f287a0407a6f87320dcfa5c
Ticket: 2901998fffffffffffffffffffffffffffffffff
Inconsistent buffered I/O
User & Date: ferrieux on 2009-11-22 10:49:10
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    On a seekable r+ channel (like a regular file), read and write operations have inconsistent interactions depending on the kind of buffering:
    
    Suppose file "foo" contains "ABC":
    
     set f [open foo r+]
     fconfigure $f -buffering none 
     puts -nonewline $f Z
     puts [read $f] ----> BC
    
    Now reset the file to ABC and try it in buffered mode:
    
     set f [open foo r+]
     fconfigure $f -buffering full 
     puts -nonewline $f Z
     puts [read $f] ----> ABC
    
    This is inconsistent. Buffering should only have effects on performance, not on semantics.
    
    Being consistent would imply always keeping the notion of a single read/write "cursor" at script level, regardless of the underlying OS-level file position pointer.
    Note that maintaining this simple coupling means simpler code in the core, the only new thing being that a read operation could now cause a flush. I have no problem with this side-effect, since buffering/flushing always happens behind the scripter's back anyway ([seek] already does it sometimes).
    
    This bug is related to, but much simpler and spectacular than, bug 2176669.
    The fix proposed here would solve both simultaneously BTW.
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "8"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "ferrieux"
  10. subsystem changed to: "25. Channel System"
  11. title changed to: "Inconsistent buffered I/O"
  12. type changed to: "Bug"