Skip to content
Tcl Source Code History Of Ticket 680143ffffffffff
Login

History Of Ticket 680143ffffffffff

Artifacts Associated With Ticket 680143ffffffffff

  1. Ticket change [29334e4414] (rid 88834) by dkf on 2003-02-04 11:52:30:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 initialized to: "obsolete: 8.4.1"
    5. priority initialized to: "9 Immediate"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dkf"
    9. subsystem initialized to: "24. Channel Commands"
    10. title initialized to: "Multi-append file surprise"
    11. type initialized to: "Bug"
  2. Ticket change [886b599f4e] (rid 131861) by hobbs on 2003-02-05 01:57:35:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      This does not appear to be anything more than a doc issue to 
      me.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. priority changed to: "1 Zero"
    5. username: "hobbs"
  3. Ticket change [2a55362b69] (rid 118543) by dkf on 2003-02-05 20:34:42:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The documentation as it stands is a correct rendering of
      what actually happens.  It is just *very* surprising from
      the point-of-view of anyone used to the way things happen in
      C (i.e. both myself and Larry Virden found this
      surprising.)  And such surprise is a bad thing for someone
      expecting to simply translate a C idiom into Tcl and get
      safe appending to a log-file.
      
      IMO, features that can lead to surprising data loss are
      dangerous bugs, no matter how well documented.  This is
      particularly the case here, where the difference between the
      "a" behaviour and the APPEND behaviour is not at all obvious
      unless you know exactly what APPEND does and why it what it
      does.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "9 Immediate"
    5. username: "dkf"
  4. Ticket change [708c447b46] (rid 100499) by hobbs on 2003-02-09 15:31:53:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      from the clt discussion, it's not even clear that the C behavior 
      is reliable across platforms.  As long as Tcl is consistent, 
      just document it, or leave it undefined.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. priority changed to: "5 Medium"
    5. username: "hobbs"
  5. Ticket change [88fdc1f997] (rid 131958) by dkf on 2003-02-10 21:33:48:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Tcl's behaviour is consistently poor across platforms.
      
      Only setting the priority to 8 as there is a script-level 
      workaround (use {WRONLY CREAT APPEND} instead of "a" 
      as the flag to [open]).  It's still highly surprising that it is 
      different from C (i.e. that Tcl can lose data where C would 
      not) though this is just something that people writing code to 
      add to log-files are going to have to beware of. :^/
      
      At the very least, open.n ought to warn people a bit more 
      clearly.  At least that'd be our CYA clause...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. username: "dkf"
  6. Ticket change [185e0eae7b] (rid 122647) by hobbs on 2003-02-22 01:54:01:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      We should address this first as a doc issue.  If someone 
      wants to write something up for 8.4.2, that's fine.  Otherwise 
      this is a long-standing behavior, so not critical.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. priority changed to: "5 Medium"
    5. username: "hobbs"
  7. Ticket change [073268ccc8] (rid 89345) by dkf on 2003-02-24 18:09:07:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The docs are correct as they stand.  Just very surprising to
      someone coming from C, as fopen()'s mode args look very
      similar but are not in this respect.  Perhaps a note that
      "a" does not use O_APPEND internally would be a good idea,
      though I still fear that people will get caught out.
      
      If the original intention of "a" like modes was to mirror
      what happens in stdio, the current behaviour is a bug no
      matter how accurately we go about documenting it.  But I
      don't actually know what classic Tcl (i.e. Tcl7.3 or 7.4
      before cross-platform support was added) did here...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  8. Ticket change [1b7caa7eb1] (rid 123163) by dgp on 2003-10-03 04:37:56:

    1. priority changed to: "8"
  9. Ticket change [f894d19ae3] (rid 91563) by dgp on 2006-03-10 11:34:41:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      What's the status of this one?
      
      Is the resolution of 1241593
      relevant?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [388abb00b8] (rid 112225) by dkf on 2006-03-10 22:18:06:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The HEAD is still brain-damaged because it still doesn't use
      O_APPEND for the 'a' mode (unlike what you'd expect if you
      used stdio, like Tcl used to waaay back).
      
      $ rm test1.out test2.out
      $ tclsh8.5
      % foreach i {1 2 3 4 5 6 7 8 9 0} {puts [open test1.out a]
      $i};exit
      $ tclsh8.5
      % foreach i {1 2 3 4 5 6 7 8 9 0} {puts [open test2.out
      {WRONLY CREAT APPEND}] $i};exit
      $ wc -c test*
            2 test1.out
           20 test2.out
           22 total
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [0a36ba1fcd] (rid 113775) by andreas_kupries on 2006-03-15 03:52:49:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      The id 1241593 is something in the FreeMind project. Which
      entry is truly meant ?
      
      Donal's phrasing (the emphasis on HEAD) seems to imply that
      the 8.4 branch has been fixed. I cannot find a change however.
      
      Do we have a patch for this somewhere ?
      
      Would there be compatibility issues if we simply add
      O_APPEND to the flags used by mode 'a' ? Like the channel
      becoming unseekable ?
      
      What happens if a non-appending channel is opened on a file
      which has an 'a' channel open ?
      
      
      
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  12. Ticket change [e1ea57fe60] (rid 87532) by dkf on 2006-03-16 05:10:21:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The 8.4 branch isn't fixed either. My phrasing is meant to
      indicate that neither is fixed, but perhaps it didn't come
      out right.
      
      I've not got a patch (and my sandboxes are full of things
      that I don't want to check into the mainline).
      
      Technically, there are compatability issues with going to
      using O_APPEND. But nobody who is using it like stdio will
      notice (stdio always used O_APPEND) except for the removal
      of the bug! And anyone seeking on an append-only channel is
      asking for trouble.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  13. Add attachment "84.append.udiff" [b076081e1f] (rid 97984) by andreas_kupries on 2006-03-17 01:24:37.

  14. Ticket change [ba0aae622f] (rid 129250) by andreas_kupries on 2006-03-17 01:24:37:

    1. icomment:
      
      
      File Added - 171162: 84.append.udiff
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  15. Add attachment "85.append.udiff" [7063e9a279] (rid 100472) by andreas_kupries on 2006-03-17 01:25:02.

  16. Ticket change [8d747533b4] (rid 127938) by andreas_kupries on 2006-03-17 01:25:02:

    1. icomment:
      
      
      File Added - 171163: 85.append.udiff
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  17. Ticket change [015c103897] (rid 119468) by andreas_kupries on 2006-03-17 01:26:20:

    1. closedate changed to: "2006-03-16T18:26:20"
    2. closer changed to: "andreas_kupries"
    3. icomment:
      Logged In: YES 
      user_id=75003
      
      The attached patches have been committed to HEAD and 8.4
      branch head resp. They add O_APPEND to the list of flags
      used when using 'a' to open a file, and provide an extended
      testsuite for the new behaviour of 'a'.
      
      
      
    4. login: "andreas_kupries"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "andreas_kupries"