Artifacts Associated With Ticket 1d26e580cfcb7ac0
Ticket change [c2de85bcf2] (rid 227292) by juliannoble2 on 2024-06-06 19:13:28:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Leaving aside the desirability of having a BOM on a utf-8 file - especially a package.. Standard Tcl interps have no problem sourcing files with a BOM. Safe interps created with safe::interpCreate don't seem able to handle it. I think it should be consistent in this regard if possible. I encountered this with a non-public package that deals with BOMs in some of its data files - and it was dogfooding I guess, so the tm has one too. Can be worked around for the package itself - but may be an issue for making that package work in a safe interp with its datafiles too depending on whether source is used. (using something like the island concept on tcl wiki to allow limited access to a section of the filesystem) e.g with a package file named bomtest-1.0.tm in current dir containing nothing but "package provide bomtest 1.0" and saved with a BOM. % tcl::tm::add [pwd] % package require bomtest 1.0 % safe::interpCreate x x % x eval {package require bomtest} invalid command name " package" - foundin initialized to: "8.7,9.0"
- is_private initialized to: "0"
- login: "juliannoble2"
- priority initialized to: "5 Medium"
- private_contact initialized to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "juliannoble2"
- subsystem initialized to: "33. Safe Base"
- title initialized to: "safe interp can't source files with BOM"
- type initialized to: "Bug"
Ticket change [97d48ba087] (rid 227294) by oehhar on 2024-06-07 09:08:32:
- icomment:
I can confirm the bug on TCL 8.6.14 32bit and 9.0b2 on Windows. I can confirm, that the space character in the log before "package" is the BOM. I also tested, that it works without the bom -> yes. The error stack of 8.6.14 below shows an explicit -encoding utf-8, while this is correctly missing in TCL9.0. <h2>Log on 8.6.14</h2> <verbatim> % cd {C:\test\bom_package} % tcl::tm::add [pwd] % package require bomtest 1.0 % safe::interpCreate x x % catch {x eval {package require bomtest}} e d 1 % set e invalid command name " package" % set d -errorstack { INNER {invokeStk1 package provide bomtest 1.0} CALL {::safe::AliasSource x -encoding utf-8 {$p(:26:)/bomtest-1.0.tm}}} -errorcode NONE -errorinfo { invalid command name " package" invoked from within "source -encoding utf-8 {$p(:26:)/bomtest-1.0.tm}" ("package ifneeded bomtest 1.0" script) invoked from within "package require bomtest" invoked from within "x eval {package require bomtest}"} -errorline 1 -code 1 -level 0 % regexp {"(.*)"} $e m f 1 % set f package % scan $f %c 65279 % x eval {package require nobomtest} 1.0 </verbatim> <h2>Log difference 9.0b2</h2> <verbatim> % set d -errorstack { INNER {invokeStk1 package provide bomtest 1.0} CALL {::safe::AliasSource x {$p(:27:)/bomtest-1.0.tm}}} -errorcode NONE -errorinfo { invalid command name "package" invoked from within "source {$p(:27:)/bomtest-1.0.tm}" ("package ifneeded bomtest 1.0" script) invoked from within "package require bomtest" invoked from within "x eval {package require bomtest}"} -errorline 1 -code 1 -level 0 </verbatim> The two test files are attached. Thank you for the bug report, Harald - login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Add attachment "bomtest-1.0.tm" [bfc84ad528] (rid 227296) by oehhar on 2024-06-07 09:09:21.
Add attachment "nobomtest-1.0.tm" [ee0285322c] (rid 227298) by oehhar on 2024-06-07 09:09:37.
Ticket change [9f81e2ccb8] (rid 227637) by jan.nijtmans on 2024-06-12 11:10:43:
- assignee changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
Ticket change [610e49c35d] (rid 227653) by jan.nijtmans on 2024-06-12 12:38:21:
- foundin changed to: "8.6"
- icomment:
Proposed fix [f612d4acfa1f604a|here] Remark: in the bugfix branch I added a BOM to "init.tcl" for testing purposes. This should NOT be merged to 8.6!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"
Ticket change [4c4d90568f] (rid 227655) by oehhar on 2024-06-12 12:58:31:
- icomment:
Great work, thank you ! Some questions: * may the new lines be moved to line 994, just before the actual use of "contents" ? * I would also love to replace the "-eof "\x1A {}"" by a check on the read data for \x1A, like <verbatim> set pos [string first $content \x1A] if {$pos != -1} {set content [string range $content 0 $pos-1] </verbatim> so we could remove -eofchar totally one day... Thank you for all, Harald - login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [6596ce1bd6] (rid 227748) by jan.nijtmans on 2024-06-13 12:05:41:
- icomment:
Fixed [a7efbe19650e6b1f|here] Changing the use of -eofchar is not a good idea IMHO. What if a file has a 100-byte script followed by \x1A followed by a 1Gb zip-file .... Then - with your proposal - the whole 1Gb will be loaded in memory. The advantage of -eofchar is that the reading stops when the character is encountered. The use of -eofchar in output channels was a bad idea, that's fixed in 9.0. But I think -eofchar should be kept for input channels.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [b3343f4a0c] (rid 227749) by jan.nijtmans on 2024-06-13 12:06:12:
- closedate changed to: "2460475.00431589"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"
Ticket change [e665278c17] (rid 227750) by oehhar on 2024-06-13 12:18:40:
- closedate changed to: "2460475.01296685"
- closer changed to: "oehhar"
- icomment:
Ok, thank you. For -eofchar, that sounds resonable. THanks for all the work, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"