Skip to content
Tcl Source Code History Of Ticket 79614fb8b61983ac
Login

History Of Ticket 79614fb8b61983ac

Artifacts Associated With Ticket 79614fb8b61983ac

  1. Ticket change [823bd9c928] (rid 149477) by pooryorick on 2016-11-07 23:03:09:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      in the following example, on a Linux system, where filesystems are
      encoding-free, the file is only opened when the Tcl system encoding is
      iso8859-1.  Furthermore, when the line
      
      <code><verbatim>set name $directory/[lindex $names 0]</verbatim></code>
      
      is moved out of the loop, the file is not successfully opened at all.
      
      <code><verbatim>
      set sysencoding_orig [encoding system]
      
      set name0 "funky \xa2 name"
      
      # Set up for the demonstration of the bug by creating a file whose name is
      # exactly the bytes in the string below
      close [open $name0 wb]
      
      set directory [pwd]
      set names [glob -directory $directory -tails *]
      foreach encoding [list $sysencoding_orig iso8859-1] {
      	encoding system $encoding 
      	set name $directory/[lindex $names 0]
      	puts [list {globbed name identical?} [expr {$name0 eq $name}]]
      	try {
      		set chan [open $name]
      		encoding system $sysencoding_orig
      		puts [list {opened with system encoding} $encoding]
      		close $chan
      	} on error {cres copts} {
      		puts [list {failed to open with system encoding} $encoding]
      	}
      }
      encoding system $sysencoding_orig
      </verbatim></code>
      
    5. foundin initialized to: "8.6.7"
    6. is_private initialized to: "0"
    7. login: "pooryorick"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Important"
    11. status initialized to: "Open"
    12. submitter initialized to: "pooryorick"
    13. subsystem initialized to: "16. Commands A-H"
    14. title initialized to:
      [glob], [encoding system] and encoding-free filesystems
      
    15. type initialized to: "Bug"
  2. Ticket change [79ad4daac2] (rid 149492) by jan.nijtmans on 2016-11-11 09:47:52:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Having a look at this one. At least the second remark (moving the "set name" out of the loop makes a difference) looks like a bug, related to the internal caching of filenames. If the system encoding changes, I think all of such cache information should become invalid.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. severity changed to: "Minor"
  3. Ticket change [fa34bdd4e3] (rid 149503) by jan.nijtmans on 2016-11-11 11:04:05:

    1. icomment:
      Well, at least, not invalidating the VFS cached information when changing the "system encoding" is a bug, fixed now in core-8-5-branch, core-8-6-branch and trunk.
      
      Whether the first mentioned "feature" is a bug, I'm not sure. If the "system coding" doesn't match the real system encoding, it's not surprising that there are problems opening some files. Maybe there is something additional (UNIX-specific) going on which causes the system encoding detection not doing what you expect. Feel free to comment on that, I'll keep this issue open for a while.
      
      Thanks for the report!
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  4. Ticket change [794fbca892] (rid 149527) by dkf on 2016-11-14 10:52:21:

    1. icomment:
      Filesystems aren't encoding-free as files have names expressed as byte sequences that represent strings, but they (usually) don't have an explicitly defined one. The system encoding is what should be used for filenames <i>by convention</i>, but it is possible to end up with some pretty weird cases where the encoding on one mounted filesystem is different to another one; this is a problem that can really bedevil you if you've got old removable drives, USB sticks, etc. Because of that, it's sometimes useful to be able to change what the system encoding is. (In particular, <tt>iso8859-1</tt> is vital because that at least lets you work with the real bytes; it's a feature of that specific encoding that it maps to the first 256 unicode characters.)
      
    2. login: "dkf"
    3. mimetype: "text/html"
  5. Ticket change [bb249d2405] (rid 152622) by jan.nijtmans on 2017-03-23 13:48:31:

    1. closedate changed to: "2457836.07536736"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Since the VFS cache update is fixed now in all branches, I consider this 'bug' fixed. In case there are objections, please feel free to re-open this Issue and/or place your further remarks here.
      
      Anyway, setting the "system encoding" to anything other than the real "system encoding" (indeed ... Filesystems aren't encoding-free at all ...) is asking for trouble. I fully agree with dkf's remarks.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"