Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 29334e4414b1ad4153a5c6b0fdd2fb6f18adee6c
Ticket: 680143ffffffffffffffffffffffffffffffffff
Multi-append file surprise
User & Date: dkf on 2003-02-04 11:52:30
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    There is a difference between the following two
    scripts:
        #!/usr/local/bin/tclsh8.4
        foreach i { 0 1 2 3 4 5 6 7 8 9 } {
            puts [open "/tmp/test.out2" "a"] $i
        }
    and
        #!/usr/local/bin/tclsh8.4
        foreach i { 0 1 2 3 4 5 6 7 8 9 } {
            puts [open "/tmp/test.out2" {WRONLY CREAT
    APPEND}] $i
        }
    
    In the first case, only a single value ("0") appears in
    the file once the script has run, but in the second
    case, all values written to the file appear in it. 
    This difference in behaviour between the "a" mode and
    the given set of options is highly surprising to me,
    and a problem since many pieces of code that add
    information to log files may well be using it assuming
    that the latter behaviour will happen.  This could lead
    to information loss when several processes append to
    the same log file, which is very serious and fairly
    tricky to reproduce reliably. Should the behaviour of
    "a" (and possibly "a+"?) be altered so as to use the
    APPEND flag internally, instead of a single seek when
    the file is opened (which must be what happens at the
    moment.)
    
  4. foundin changed to: "obsolete: 8.4.1"
  5. priority changed to: "9 Immediate"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "dkf"
  9. subsystem changed to: "24. Channel Commands"
  10. title changed to: "Multi-append file surprise"
  11. type changed to: "Bug"