Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 41982fa932edf338da1412e0c9e25244cd25c0c2
Ticket: 1999176fffffffffffffffffffffffffffffffff
glob can cause crash on windows Tcl8.5.2
User & Date: pointsman on 2008-06-29 23:36:20
Changes

  1. icomment:
    Logged In: YES 
    user_id=13222
    Originator: NO
    
    The fix seems to leak.
    
    With 8.5.3rc0 w/ 2004654 patch the following script shows the leak:
    
    while 1 {
        interp create moo
        moo eval {
            package require tcltest
            namespace import tcltest::*
    
            proc createfile {file {string a}} {
                set f [open $file w]
                puts -nonewline $f $string
                close $f
                return $string
            }
    
            proc cleanup {args} {
                set wd [list .]
                foreach p [concat $wd $args] {
                    set x ""
                    catch {
                        set x [glob -directory $p tf* td*]
                    }
                    foreach file $x {
                        if {
                            [catch {file delete -force -- $file}]
                            && [testConstraint testchmod]
                        } then {
                            catch {openup $file}
                            catch {file delete -force -- $file}
                        }
                    }
                }
            }
    
            for {set i 0} {$i < 1000} {incr i} {
                test fCmd-10.11 {file copy: copy to empty file name} -setup {
                    cleanup
                } -returnCodes error -body {
                    createfile tf1
                    file copy tf1 ""
                } -result {error copying "tf1" to "": no such file or directory}
            }
        }
        puts moo
        interp delete moo
    }
    
    The script leaks slowly enough, to be watched with top without danger.
    
    The tests fCmd-10.11 and fCmd-10.12 out of the test suite trigger the leak. Attached is the relevant part of a valgrind output (-DPURIFY build).
    
    
    
  2. login: "pointsman"
  3. mimetype: "text/plain"
  4. username: "pointsman"