From: SourceForge.net <no...@so...> - 2009-02-04 22:42:25
|
Bugs item #2511011, was opened at 2009-01-15 14:31 Message generated for change (Comment added) made by dgp You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2511011&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 36. Pathname Management Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mark Janssen (mpc_janssen) Assigned to: Vince Darley (vincentdarley) Summary: [glob] can return non-existing filenames Initial Comment: glob doesn't escape filenames starting with ~. This means glob by default can return filenames that 1) don't exists (annoying) or even point to a different spot all together (a user directory for instance, which is outright dangerous). For example: create a file name "~test" % foreach file [glob *] { if {![file exists $file]} {puts "huh $file doesn't exists"}} huh ~test doesn't exists % info pa 8.5.4 Interactive session above was with Tcl 8.5.4. Dangerous situations can occur if a filename matches a valid user directory (~ for instance) and results of glob are used in recursive delete operations (which would lead to removal of the users home dir in this case) It seems that me that glob should properly escape ~ as "./~test". ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2009-02-04 17:42 Message: There's a related regression in [file tail]: % set files [glob *oo] ~boo ~foo % set files2 [glob -directory [pwd] *oo] /home/dgp/cvs/tcl8.4/unix/~boo /home/dgp/cvs/tcl8.4/unix/~foo % file tail [lindex $files2 0] ./~boo % info patch 8.4.19 % set files [glob *oo] ~foo ~boo % set files2 [glob -directory [pwd] *oo] /home/dgp/cvs/tcl8.5/unix/~foo /home/dgp/cvs/tcl8.5/unix/~boo % file tail [lindex $files2 0] ~foo % file tail /home/dgp/cvs/tcl8.5/unix/~foo ./~foo % info patch 8.5.6 The symptoms point to inconsistent handling of values of the "path" Tcl_ObjType depending on the details of the intrep. Same string ought to produce same results, but do not. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2511011&group_id=10894 |