From: <no...@tc...> - 2025-10-08 00:03:53
|
Automated mail by fx, on behalf of no...@tc... Ticket Change [cf2744c4d020feb157487d837b46423ccfdb4d5090f80a88ae9831402c99a810] ["crc32 -filename $name" end in error on files with special content (not encoding problem)] By anonymous For Tcllib On 2025-10-07T23:54:35.985 Details https://core.tcl-lang.org/tcllib/tinfo?name=cf2744c4d020feb157487d837b46423ccfdb4d5090f80a88ae9831402c99a810 Ticket https://core.tcl-lang.org/tcllib/tktview/7bd2d439ca61da14a9fc5e8372e5fb1f86c28ff1 Changed Fields assignee: icomment: @Pat Thoyts or @apnadkarni: crc32 with option "-file" should use the opened file using "fconfigure -encoding iso8859-1" to prevent problems from binary files. Loading the files into memory (so them are all in unicodes from 0 to 255) and use crc32 with option "-data" brings the same error. The only difference for "-file" is the not closing/not releasing the file handle. This may occur on Tcl 9.0 by reading binary codes in the file which can not decoded. As Uli E. stated, it may be work-around using the not documented option "-chunksize". But for really large files/data this is not the solution alone. The problem occurs on combining the crc32 result for each chunk. Maybe for Tcl 9.0 there is a need for another sign-handling? Additionally, with the error "integer value too large to represent" the handle for option -file is leaved open too. Because both named (examples) files are in correct (strict) encoding, the calculation is the first part, the correct fconfigure the second part, and try-catch errors to finally close the opened file the third part to be resolved. As mentioned, the same may be necessary for crc16, cksum and sum too! login: anonymous username: [TWu] ------------------------------------------------------------ See Tcl/Tk development @ http://core.tcl-lang.org/ ------------------------------------------------------------ |