diff options
author | dgp <dgp@noemail.net> | 2008-08-13 18:12:54 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2008-08-13 18:12:54 (GMT) |
commit | 40a2877162176e0504d6e91fd2ca75339a23eda8 (patch) | |
tree | ed726018a4af09887f994869575e0253fe2487a5 | |
parent | 1ddf07bfb51513a339ea24eba5a33bbc2b13b4e1 (diff) | |
download | tcl-40a2877162176e0504d6e91fd2ca75339a23eda8.zip tcl-40a2877162176e0504d6e91fd2ca75339a23eda8.tar.gz tcl-40a2877162176e0504d6e91fd2ca75339a23eda8.tar.bz2 |
* generic/tclFileName.c: Fix for errors handling -types {}
* tests/fileName.test: option to [glob]. [Bug 1750300]
Thanks to Matthias Kraft and George Peter Staplin.
FossilOrigin-Name: 2e92ce0921cab5b3bbc384c63ab37410c393e0bb
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclFileName.c | 6 | ||||
-rw-r--r-- | tests/fileName.test | 39 |
3 files changed, 49 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2008-08-13 Don Porter <dgp@users.sourceforge.net> + + * generic/tclFileName.c: Fix for errors handling -types {} + * tests/fileName.test: option to [glob]. [Bug 1750300] + Thanks to Matthias Kraft and George Peter Staplin. + 2008-08-12 Don Porter <dgp@users.sourceforge.net> *** 8.5.4 TAGGED FOR RELEASE *** diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 80391f7..1c4b97e 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFileName.c,v 1.86 2007/12/13 15:23:17 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.86.2.1 2008/08/13 18:12:56 dgp Exp $ */ #include "tclInt.h" @@ -1412,6 +1412,9 @@ Tcl_GlobObjCmd( */ Tcl_ListObjLength(interp, typePtr, &length); + if (length <= 0) { + goto skipTypes; + } globTypes = (Tcl_GlobTypeData*) TclStackAlloc(interp,sizeof(Tcl_GlobTypeData)); globTypes->type = 0; @@ -1529,6 +1532,7 @@ Tcl_GlobObjCmd( } } + skipTypes: /* * Now we perform the actual glob below. This may involve joining together * the pattern arguments, dealing with particular file types etc. We use a diff --git a/tests/fileName.test b/tests/fileName.test index 4cd079b..e603c5a 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: fileName.test,v 1.51 2006/03/21 11:12:29 dkf Exp $ +# RCS: @(#) $Id: fileName.test,v 1.51.8.1 2008/08/13 18:12:56 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1534,6 +1534,43 @@ test fileName-19.1 {ensure that [Bug 1325099] stays fixed} { list [file exists ~//.nonexistant_file] [file exists ~///.nonexistant_file] } {0 0} +test fileName-20.1 {Bug 1750300} -setup { + set d [makeDirectory foo] + makeFile {} TAGS $d +} -body { + llength [glob -nocomplain -directory $d -- TAGS tags Tags] +} -cleanup { + removeFile TAGS $d + removeDirectory foo +} -result 1 +test fileName-20.2 {Bug 1750300} -setup { + set d [makeDirectory foo] + makeFile {} TAGS $d +} -body { + llength [glob -nocomplain -directory $d -types {} -- TAGS tags Tags] +} -cleanup { + removeFile TAGS $d + removeDirectory foo +} -result 1 +test fileName-20.3 {Bug 1750300} -setup { + set d [makeDirectory foo] + makeFile {} TAGS $d +} -body { + llength [glob -nocomplain -directory $d -types {} -- *U*] +} -cleanup { + removeFile TAGS $d + removeDirectory foo +} -result 0 +test fileName-20.4 {Bug 1750300} -setup { + set d [makeDirectory foo] + makeFile {} TAGS $d +} -body { + llength [glob -nocomplain -directory $d -types {} -- URGENT Urgent] +} -cleanup { + removeFile TAGS $d + removeDirectory foo +} -result 0 + # cleanup catch {file delete -force C:/globTest} cd [temporaryDirectory] |