From: <no...@so...> - 2001-08-10 08:35:09
|
Bugs item #223313, was opened at 2000-11-24 01:38 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112997&aid=223313&group_id=12997 Category: Widget Tour Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Vince Darley (vincentdarley) Assigned to: Donal K. Fellows (dkf) Summary: many uses of 'glob [file join $dir $pat]' in Tcl and Tk Initial Comment: Almost all uses of 'glob [file join $dir $pat]' are bugs. (Does procheck report an error for these statements?). If the directory '$dir' contains glob sensitive characters, the command will either fail or return bad results. The correct version is: glob -dir $dir $pat or for 'glob [file join $dir * $pat]' we need: glob -dir $dir -join * $pat (or variants on that theme). A search through my 'lib' hierarchy shows the following instances, all of which are bugs. These are in Tcl's library, Tk's library and in some iwidgets code. Vince. C:/Program Files/Tcl/lib/iwidgets3.0.0/demos/catalog "catalog"; Line 392: foreach file [lsort [glob [file join ${iwidgets::library} demos *]]] { C:/Program Files/Tcl/lib/iwidgets3.0.0/scripts/extfileselectionbox.itk "extfileselectionbox.itk"; Line 791: set files [lsort [glob -nocomplain [file join $_pwd $mask]]] C:/Program Files/Tcl/lib/iwidgets3.0.0/scripts/fileselectionbox.itk "fileselectionbox.itk"; Line 749: set files [lsort [glob -nocomplain [file join $_pwd $mask]]] C:/Program Files/Tcl/lib/tcl8.4/package.tcl "package.tcl"; Line 440: foreach x [glob -nocomplain [file join $dir *.shlb]] { C:/Program Files/Tcl/lib/tcl8.4/package.tcl "package.tcl"; Line 480: foreach file [glob -nocomplain [file join $dir * pkgIndex.tcl]] { C:/Program Files/Tcl/lib/tcl8.4/package.tcl "package.tcl"; Line 512: foreach x [glob -nocomplain [file join $dir *]] { C:/Program Files/Tcl/lib/tcl8.4/safe.tcl "safe.tcl"; Line 499: foreach sub [glob -nocomplain -- [file join $dir *]] { C:/Program Files/Tcl/lib/tcl8.4/tcltest1.0/tcltest.tcl "tcltest.tcl"; Line 1579: [glob -nocomplain [file join $directory $match]]] C:/Program Files/Tcl/lib/tcl8.4/tcltest1.0/tcltest.tcl "tcltest.tcl"; Line 1585: [glob -nocomplain [file join $directory $skip]]] C:/Program Files/Tcl/lib/tk8.4/demos/image2.tcl "image2.tcl"; Line 23: foreach i [lsort [glob [file join $dirName *]]] { ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2001-08-10 01:35 Message: Logged In: YES user_id=79902 OK, sorted except for itk. But that's a separate project (currently) and so None Of My Business. :^) ---------------------------------------------------------------------- Comment By: Vince Darley (vincentdarley) Date: 2001-08-08 10:55 Message: Logged In: YES user_id=32170 Attached a patch to fix this problem in Tk, then it will only be a problem in iwidgets. diff -U3 -r1.2 image2.tcl --- image2.tcl 1998/09/14 18:23:29 1.2 +++ image2.tcl 2001/08/08 17:53:48 @@ -20,7 +20,7 @@ global dirName $w.f.list delete 0 end - foreach i [lsort [glob [file join $dirName *]]] { + foreach i [lsort [glob -directory $dirName *]] { $w.f.list insert end [file tail $i] } } ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2000-11-24 06:17 Message: Fixed in Tcl. Now a Tk bug only... ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112997&aid=223313&group_id=12997 |