Overview
| Artifact ID: | da2680b60fba5093fd053b9f3c1c06ec13691e8b |
|---|---|
| Ticket: | 511666ffffffffffffffffffffffffffffffffff
glob with full path ignores -types |
| User & Date: | vincentdarley on 2002-02-01 12:29:51 |
Changes
- assignee changed to: "vincentdarley"
- cmimetype changed to: "text/plain"
- comment changed to:
Various emails discussing this bug quoted below: Hi Vince, (iii) sounds workable with modest "surprise" added to the design. In this case the special handling seems appropriate. I say this still w/o seeing the code. A patch would be great because I think (i) is just plain goofy. - Thanks. Roy > I've looked into this further and I see three options: > > (i) ignore the bug and define 'glob' to behave in this way when the user > gives a fully-specified file name (i.e. when there's no pattern matching). > > (ii) add a new filesystem-specific API (i.e. yet another Tcl_FS... function > which must be implemented for each filesystem) which matches file-types > according to 'Tcl_GlobTypeData'. This function could be used to simplify > each 'TclpMatchInDirectory' implementation, perhaps, (loop over each file > which matches the glob pattern and pass that file to the new API), although > there might be a performance penalty to pay. > > (iii) change the way TclpMatchInDirectory works so that it can handle the > special case we need here. This can be done in a backwards compatible way > as follows: if 'pattern' is NULL then consider the 'pathPtr' which is > passed in not as a directory in which to search, but as a fully-specified > path to check against 'types'. This is backwards compatible because the > code will currently segfault if pattern is NULL (but pattern is currently > never NULL, of course). > > I would lean towards (iii) as the best solution, since (ii) is needlessly > complicated and (i) isn't very good. However, if we do adopt (iii) we might > then wish to change the name of the function too (it's a new function in > Tcl 8.4a3 so changing it isn't a compatibility issue). > > Any thoughts? > > Vince. > > Note: my original suggestion of duplicating code in tclFileName.c is no > good, because that code is filesystem/platform specific (because matching > against 'Tcl_GlobTypeData' is platform specific). > > At 09:51 AM 1/22/2002 -0800, Roy Terry wrote: > >Vince, > >I take your word for it. I wasn't able to find it in > >my source which which I believe is 8.4a3 and where > >RCS: @(#) $Id: tclFileName.c,v 1.16 2001/08/07 01:00:02 hobbs Exp $ > >only has 2360 lines. I must be behind a bit. For my 2 cents, > >I'd be a bit concerned about duplicating though certainly the essential > >properties of files seem pretty stable. I will be refreshing my > >code in the next few weeks so if you've not put in a fix by then > >I'll get back in touch and see If I can contribute. > > > > > >Thanks, > >Roy > > > > > Found a few minutes to look more closely at the code. Basic problem which > > > needs fixing starts in the block of code at line 2477 of > > > tclFileName.c. This code doesn't pay any attention to the 'types' argument > > > of the function (TclDoGlob). While there may be elegant ways of fixing the > > > code without duplication (as alluded to below), if one adds suitable > > > 'types' checking to that block of code, it'll fix this problem. > > > > > > cheers, > > > > > > Vince. > > > > > > At 04:22 PM 1/21/2002 -0800, Jeff Hobbs wrote: > > > >Roy Terry wrote: > > > > > > > > > > In the following transcript, notice how the > > > > > -types restriction seems to be ignored if > > > > > a literal file name is given. > > > > > > > >Yes, that does seem to be the case, tested on the head and 8.3.4. > > > >Evidently the -types check isn't being heeded when there is just > > > >one file matching, or something like that. > > > > > > > > > (tmp) 84 % ls -l > > > > > ./: > > > > > -r--r--r-- 316 Jan 18 12:56 x > > > > > (tmp) 85 % glob -types f ? > > > > > x > > > > > (tmp) 86 % glob -types f . > > > > > . > > > > > (tmp) 87 % glob -types w ? > > > > > no files matched glob pattern "?" > > > > > (tmp) 88 % glob -types w x > > > > > x > > > > > (tmp) 89 % puts $tcl_patchLevel > > > > > 8.4a4 > > > > > (tmp) 90 % parray tcl_platform > > > > > tcl_platform(byteOrder) = littleEndian > > > > > tcl_platform(machine) = intel > > > > > tcl_platform(os) = Windows NT > > > > > tcl_platform(osVersion) = 4.0 > > > > > tcl_platform(platform) = windows > > > > > tcl_platform(user) = roy > > > > > (tmp) 91 % > > > >
- foundin changed to: "obsolete: 8.4a4"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "vincentdarley"
- subsystem changed to: "37. File System"
- title changed to: "glob with full path ignores -types"
- type changed to: "Bug"