Skip to content
Tcl Source Code History Of Ticket 1d26e580cfcb7ac0
Login

History Of Ticket 1d26e580cfcb7ac0

Artifacts Associated With Ticket 1d26e580cfcb7ac0

  1. Ticket change [c2de85bcf2] (rid 227292) by juliannoble2 on 2024-06-06 19:13:28:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. 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"
      
    5. foundin initialized to: "8.7,9.0"
    6. is_private initialized to: "0"
    7. login: "juliannoble2"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "juliannoble2"
    14. subsystem initialized to: "33. Safe Base"
    15. title initialized to: "safe interp can't source files with BOM"
    16. type initialized to: "Bug"
  2. Ticket change [97d48ba087] (rid 227294) by oehhar on 2024-06-07 09:08:32:

    1. 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
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  3. Add attachment "bomtest-1.0.tm" [bfc84ad528] (rid 227296) by oehhar on 2024-06-07 09:09:21.

  4. Add attachment "nobomtest-1.0.tm" [ee0285322c] (rid 227298) by oehhar on 2024-06-07 09:09:37.

  5. Ticket change [9f81e2ccb8] (rid 227637) by jan.nijtmans on 2024-06-12 11:10:43:

    1. assignee changed to: "jan.nijtmans"
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  6. Ticket change [610e49c35d] (rid 227653) by jan.nijtmans on 2024-06-12 12:38:21:

    1. foundin changed to: "8.6"
    2. 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!
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. resolution changed to: "Fixed"
    6. status changed to: "Pending"
  7. Ticket change [4c4d90568f] (rid 227655) by oehhar on 2024-06-12 12:58:31:

    1. 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
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  8. Ticket change [6596ce1bd6] (rid 227748) by jan.nijtmans on 2024-06-13 12:05:41:

    1. 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.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  9. Ticket change [b3343f4a0c] (rid 227749) by jan.nijtmans on 2024-06-13 12:06:12:

    1. closedate changed to: "2460475.00431589"
    2. closer changed to: "jan.nijtmans"
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"
  10. Ticket change [e665278c17] (rid 227750) by oehhar on 2024-06-13 12:18:40:

    1. closedate changed to: "2460475.01296685"
    2. closer changed to: "oehhar"
    3. icomment:
      Ok, thank you. For -eofchar, that sounds resonable.
      
      THanks for all the work,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"