Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 97d48ba087038dfd93eafe644f80358bd63d899beb179be0638cbdaa223220a3
Ticket: 1d26e580cfcb7ac096cfe9cd76c87f39415120c2
safe interp can't source files with BOM
User & Date: oehhar on 2024-06-07 09:08:32
Changes

  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"