Artifacts Associated With Ticket 3d01d51bc4
Ticket change [e219faca47] (rid 208663) by pointsman on 2023-02-11 00:26:24:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
This script: package require Tcl 9.0 set fd [open large.txt w+] puts $fd [string repeat [string repeat [string repeat abc 1000] 1000] 1000] close $fd runs without sign of error. On debian 11.6 the created file large.txt has a size 1 byte (a linefeed). Seems wrong to me.
- foundin initialized to: "9.0, trunk"
- is_private initialized to: "0"
- login: "pointsman"
- priority initialized to: "5 Medium"
- private_contact initialized to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "pointsman"
- subsystem initialized to: "25. Channel System"
- title initialized to: "Tcl 9: Cannot write large strings to file"
- type initialized to: "Bug"
Ticket change [92c707debe] (rid 209211) by apnadkarni on 2023-02-25 16:50:59:
- assignee changed to: "apnadkarni"
- icomment:
Tcl_Size (WriteObj) -> int (Write) truncation at work again. Examining...
- login: "apnadkarni"
- mimetype: "text/plain"
Ticket change [944446fc08] (rid 209216) by apnadkarni on 2023-02-25 17:24:46:
- icomment: "Proposed fix [57fb62005d]"
- login: "apnadkarni"
- mimetype: "text/x-fossil-plain"
Ticket change [1f2d42b8e6] (rid 209231) by jan.nijtmans on 2023-02-26 12:44:44:
- icomment: "Proposed Solution is 100% OK with me. Thanks!"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [90c5461c0c] (rid 209244) by jan.nijtmans on 2023-02-26 14:35:04:
- icomment:
Build is failing on Windows: [https://github.com/tcltk/tcl/actions/runs/4274069270/jobs/7440407165]
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [e4dd54c333] (rid 209284) by apnadkarni on 2023-02-27 03:15:47:
- icomment:
Added the perf constraint to prevent failures on large IO tests in limited environments like github actions.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [295bf672c8] (rid 209290) by jan.nijtmans on 2023-02-27 12:01:27:
- closedate changed to: "2460003.00101183"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed [186e4d93170ed65f|here] Many thanks, Ashok!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [24a98533c5] (rid 213727) by pointsman on 2023-04-23 23:38:20:
- closedate changed to: "2460058.48496203"
- closer changed to: "pointsman"
- icomment:
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 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/plain"
Ticket change [351fab4600] (rid 213728) by pointsman on 2023-04-23 23:44:35:
- closedate changed to: "2460058.48930185"
- icomment:
[Sorry, hadn't changed from plain text to links only. For your convenience here the same again:] 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 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"