Artifacts Associated With Ticket 680143ffffffffff
Ticket change [29334e4414] (rid 88834) by dkf on 2003-02-04 11:52:30:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- 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.) - foundin initialized to: "obsolete: 8.4.1"
- priority initialized to: "9 Immediate"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dkf"
- subsystem initialized to: "24. Channel Commands"
- title initialized to: "Multi-append file surprise"
- type initialized to: "Bug"
Ticket change [886b599f4e] (rid 131861) by hobbs on 2003-02-05 01:57:35:
- icomment:
Logged In: YES user_id=72656 This does not appear to be anything more than a doc issue to me.
- login: "hobbs"
- mimetype: "text/plain"
- priority changed to: "1 Zero"
- username: "hobbs"
- icomment:
Ticket change [2a55362b69] (rid 118543) by dkf on 2003-02-05 20:34:42:
- 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.
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "dkf"
- icomment:
Ticket change [708c447b46] (rid 100499) by hobbs on 2003-02-09 15:31:53:
- 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.
- login: "hobbs"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- username: "hobbs"
- icomment:
Ticket change [88fdc1f997] (rid 131958) by dkf on 2003-02-10 21:33:48:
- 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... - login: "dkf"
- mimetype: "text/plain"
- priority changed to: "8"
- username: "dkf"
- icomment:
Ticket change [185e0eae7b] (rid 122647) by hobbs on 2003-02-22 01:54:01:
- 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.
- login: "hobbs"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- username: "hobbs"
- icomment:
Ticket change [073268ccc8] (rid 89345) by dkf on 2003-02-24 18:09:07:
- 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...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [1b7caa7eb1] (rid 123163) by dgp on 2003-10-03 04:37:56:
- priority changed to: "8"
Ticket change [f894d19ae3] (rid 91563) by dgp on 2006-03-10 11:34:41:
- icomment:
Logged In: YES user_id=80530 What's the status of this one? Is the resolution of 1241593 relevant?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [388abb00b8] (rid 112225) by dkf on 2006-03-10 22:18:06:
- 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 - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [0a36ba1fcd] (rid 113775) by andreas_kupries on 2006-03-15 03:52:49:
- 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 ?
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [e1ea57fe60] (rid 87532) by dkf on 2006-03-16 05:10:21:
- 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.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Add attachment "84.append.udiff" [b076081e1f] (rid 97984) by andreas_kupries on 2006-03-17 01:24:37.
Ticket change [ba0aae622f] (rid 129250) by andreas_kupries on 2006-03-17 01:24:37:
- icomment:
File Added - 171162: 84.append.udiff
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Add attachment "85.append.udiff" [7063e9a279] (rid 100472) by andreas_kupries on 2006-03-17 01:25:02.
Ticket change [8d747533b4] (rid 127938) by andreas_kupries on 2006-03-17 01:25:02:
- icomment:
File Added - 171163: 85.append.udiff
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [015c103897] (rid 119468) by andreas_kupries on 2006-03-17 01:26:20:
- closedate changed to: "2006-03-16T18:26:20"
- closer changed to: "andreas_kupries"
- 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'.
- login: "andreas_kupries"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "andreas_kupries"