Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d0927f230d9f0f18567592a200f796fc14c47f13
Ticket: 2918610fffffffffffffffffffffffffffffffff
Wrong file opened
User & Date: magv on 2009-12-21 11:28:03
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Here's a stripped down code snippet:
    
        set root somedir
        exec rm -rf $root
        exec mkdir -p $root
        exec touch $root/x.y
    
        file normalize anything
    
        foreach fn [glob $root/x.y] {
            set ofn [file rootname $fn]
            set fl [open $ofn {WRONLY CREAT}]
            puts $fl "something"
            close $fl
        }
    
        puts [exec ls $root]
    
    I expect this code to put "something" into somedir/x, and then print x and x.y. Instead it puts "something" into somedir/x.y, and prints x.y; somedir/x is not created, even though $ofn is somedir/x.
    
    I tried this code in the following environments:
    
    * FreeBSD/i386 7-STABLE, Tcl 8.4.19 -- works as expected
    * FreeBSD/i386 7-STABLE, Tcl 8.5.8 -- fails as described
    * FreeBSD/i386 7-STABLE, Tcl 8.6-b1 -- fails as described
    * FreeBSD/amd64 8.0-RC2, Tcl 8.5.8 -- fails as described
    * Windows XP, ActiveTcl 8.5.8 -- works as expected
    
    Alexandre Ferrieux was kind enough to test in another environment [1]:
    
    * Windows/MinGW, Tcl 8.5-HEAD -- works as expected
    
    Note that removing the void [file normalize], replacing glob with it's value, or removing foreach loop also makes it work as expected.
    
    I will try to run the code on other systems to see if it's specific to FreeBSD (maybe FreeBSD port patches are to blame).
    
    [1] http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/859e950831fa3e9b
    
  4. foundin changed to: "obsolete: 8.5.8"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "magv"
  10. subsystem changed to: "24. Channel Commands"
  11. title changed to: "Wrong file opened"
  12. type changed to: "Bug"