Skip to content
Tcl Source Code History Of Ticket c7aa14ffdd2507dd
Login

History Of Ticket c7aa14ffdd2507dd

Artifacts Associated With Ticket c7aa14ffdd2507dd

  1. Ticket change [2304fa4e87] (rid 146568) by anonymous on 2016-04-25 09:16:46:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      Tested on RHEL 6.5 (Linux 2.6.32-431.el6.x86_64) and Tcl 8.5.7.
      
      From the Linux command line with LANG set to C I can create and manipulate the following file in a bash shell:
      
      % echo "Test it" > 'test{'
      % cat 'test{'
      
      However if I start tclsh the following happens:
      
      % set name [glob test*]
      test\{
      % set fh [open $name r]
      couldn't open "test\{": no such file or directory
      
      The encoding seems to have been defaulted to iso8859-1 but this seems to mean that certain files cannot be accessed reliably in Tcl.
      
      % encoding system
      iso8859-1
      
    5. foundin initialized to: "8.5.16"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "6a3810e551109494cf10711fdd242d10cbfd3a32"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to: "Linux C locale and filenames"
    16. type initialized to: "Bug"
  2. Ticket change [d603c8d4b5] (rid 146569) by jan.nijtmans on 2016-04-25 09:45:29:

    1. icomment:
      The reason for this is that [glob] returns a list of files, not a filename, that's why the '\' needs to be inserted to form a valid Tcl list. So, your code should be (assuming you want to open the first file in the glob list):
      
      % set name [lindex [glob test*] 1]
      test{
      % set fh [open $name r]
      file3
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  3. Ticket change [2d6ffd0194] (rid 146570) by jan.nijtmans on 2016-04-25 09:46:04:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2457503.90699108"
    3. closer changed to: "jan.nijtmans"
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
  4. Ticket change [af02851110] (rid 146571) by dgp on 2016-04-25 15:49:02:

    1. closedate changed to: "2457504.15905155"
    2. closer changed to: "dgp"
    3. icomment:
      
      Caution: Tcl list indices start with 0, not 1.
      
    4. login: "dgp"
    5. mimetype: "text/plain"