|
2023-04-23
| ||
| 23:44 | • Ticket [3d01d51bc4] Tcl 9: Cannot write large strings to file status still C... artifact: 351fab4600 user: pointsman | |
| 23:38 | • Ticket [3d01d51bc4]: 5 changes artifact: 24a98533c5 user: pointsman | |
|
2023-03-22
| ||
| 13:06 | Merge trunk: Fix [3d01d51bc4]: Tcl 9: Cannot write large strings to file. Also some size_t -> Tcl_Si... check-in: dca9979ed8 user: pooryorick tags: unchained | |
|
2023-02-27
| ||
| 12:01 | • Closed ticket [3d01d51bc4]: Tcl 9: Cannot write large strings to file plus 6... artifact: 295bf672c8 user: jan.nijtmans | |
| 11:59 | Fix [3d01d51bc4]: Tcl 9: Cannot write large strings to file. Also some size_t -> Tcl_Size changes. check-in: 186e4d9317 user: jan.nijtmans tags: trunk, main | |
| 03:15 | • Ticket [3d01d51bc4] Tcl 9: Cannot write large strings to file status still O... artifact: e4dd54c333 user: apnadkarni | |
|
2023-02-26
| ||
| 14:35 | • Ticket [3d01d51bc4]: 3 changes artifact: 90c5461c0c user: jan.nijtmans | |
| 12:44 | • Ticket [3d01d51bc4]: 3 changes artifact: 1f2d42b8e6 user: jan.nijtmans | |
| 06:16 | • New ticket [90ff9b7f73] Cannot write a file of size 4294967295. artifact: bca1eb6d02 user: apnadkarni | |
|
2023-02-25
| ||
| 17:24 | • Ticket [3d01d51bc4] Tcl 9: Cannot write large strings to file status still O... artifact: 944446fc08 user: apnadkarni | |
| 16:50 | • Ticket [3d01d51bc4]: 4 changes artifact: 92c707debe user: apnadkarni | |
|
2023-02-11
| ||
| 00:26 | • New ticket [3d01d51bc4]. artifact: e219faca47 user: pointsman | |
Tcl 9: Cannot write large strings to file
Closed / Fixed3d01d51bc45cf7c53938d23f7ac4a364341a878dCreated 4 years agoUpdated 4 years ago
Descriptionplain2023-02-11 00:26:24
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.
Referenced by3
dca9979ed8Merge trunk: Fix [3d01d51bc4]: Tcl 9: Cannot write large strings to file. Also some size_t -> Tcl_Size changes. check-in2023-03-22 13:06:58186e4d9317Fix [3d01d51bc4]: Tcl 9: Cannot write large strings to file. Also some size_t -> Tcl_Size changes. check-in2023-02-27 11:59:54bca1eb6d02New ticket [90ff9b7f73] Cannot write a file of size 4294967295. ticket2023-02-26 06:16:33
apnadkarniplain2023-02-25 16:50:59
Tcl_Size (WriteObj) -> int (Write) truncation at work again. Examining...
apnadkarniplain2023-02-25 17:24:46
Proposed fix [57fb62005d]
jan.nijtmanswiki2023-02-26 12:44:44
Proposed Solution is 100% OK with me. Thanks!
jan.nijtmanswiki2023-02-26 14:35:04
Build is failing on Windows:
https://github.com/tcltk/tcl/actions/runs/4274069270/jobs/7440407165
apnadkarniplain2023-02-27 03:15:47
Added the perf constraint to prevent failures on large IO tests in limited environments like github actions.
jan.nijtmanswiki2023-02-27 12:01:27
Fixed [here]
Many thanks, Ashok!
pointsmanplain2023-04-23 23:38:20
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"
pointsmanplain2023-04-23 23:44:35
[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"
Log in (anonymous is fine) to add a comment.