Overview
| Artifact ID: | e1ac8520fc00322b9305d00e48555b781f674d9ea836fb4fa4517a12b94dcbf7 |
|---|---|
| Ticket: | 0306a5563c65ab14410c426f59f00d714bf276fc
Writing large strings to file create wrong results |
| User & Date: | pointsman on 2023-04-23 23:57:41 |
Changes
- icomment:
[Sorry again. While not completely wrong at the previous place it belongs to here.] The fix for[3d01d51bc4] with commit [186e4d9317] didn't really fix the problem. Look at [https://core.tcl-lang.org/tcl/artifact?udc=1&ln=4262-4278&name=ce11265346dd36a3] In that loop the scr pointer will not be incrementend. Which means that after every INT_MAX bytes written it starts over from the start of the string instead of continuing. This explains the output of the examples given so far. An obvious fix is https://core.tcl-lang.org/tcl/artifact?udc=1&ln=4276&name=abf0f8ddf7519a1f with which all the so far given examples run as expected. But this raises the question what WriteChars(chanPtr, src, chunkSize) does if the chunkSize ends in the middle of a multibyte char? Some answers to that question doesn't look promissing (need a Tcl 9 tcltest to run this example script): set s [testbigdata string 0x7FFFFFFE] # The character to append in the next line is EM DASH, # code point 0x2014 (decimal 8212, UTF-8 #xE2 #x80 #x94, append s — set fd [open out.txt w+] puts $fd $s close $fd If I run this (on debian) I get: error writing "file6": invalid or incomplete multibyte or wide character while executing "puts $fd $s" - login: "pointsman"
- mimetype: "text/x-fossil-plain"