Artifacts Associated With Ticket 434876ffffffffff
Ticket change [0594901f57] (rid 89087) by lvirden on 2001-06-20 18:50:24:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
In all versions of tcl that I have tested the following seems to be incorrect: $ tclsh % ln -s /lwv /tmp/notthere % glob /tmp/notthere* /tmp/notthere % glob /tmp/notthere no files matched glob pattern "/tmp/notthere" while evaluating {glob /tmp/notthere} For some reason, glob reads too 'deeply' into the fact that the file being pointed at does not yet appear. In cases where the file name is a value being passed by the user, it becomes nearly impossible to work around this bug. - foundin initialized to: "obsolete: 8.4a3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "lvirden"
- subsystem initialized to: "37. File System"
- title initialized to: "glob of symlink returns incorrect err"
- type initialized to: "Bug"
Ticket change [817810076a] (rid 117041) by vincentdarley on 2001-08-16 22:03:04:
- icomment:
Logged In: YES user_id=32170 There have been some changes to this code in the 8.4a3 (after the vfs code was added), do you still see this problem? It does appear as if Tcl is doing something slightly wrong wrt stat-vs-lstat...
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [bbc0ca9dc6] (rid 129542) by vincentdarley on 2001-08-17 00:00:42:
- icomment:
Logged In: YES user_id=32170 There have been some changes to this code in the 8.4a3 (after the vfs code was added), do you still see this problem? It does appear as if Tcl is doing something slightly wrong wrt stat-vs-lstat...
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [ece288fc8b] (rid 103783) by lvirden on 2001-08-17 00:09:30:
- icomment:
Logged In: YES user_id=15949 Yes, I still see this behavior with the latest (last nite) version of tcl.
- login: "lvirden"
- mimetype: "text/plain"
- username: "lvirden"
- icomment:
Ticket change [a6df8d2914] (rid 98681) by vincentdarley on 2001-08-18 00:16:56:
- icomment:
Logged In: YES user_id=32170 glob, or more precisely 'TclDoGlob' in tclFileName.c (near the very end of the file) uses this piece of code to decide whether to add a complete file name (no pattern involved) to the result: if (Tcl_Access(name, F_OK) == 0) { then add to glob result } This differs to the pattern matching code (TclpMatchInDirectory) which will simply add anything returned by the OS 'opendir/readdir' combination, without actually checking whether the file exists (unless you pass in additional '-types' arguments). So, the solution would seem to be to change that Tcl_Access to something else. Or at least, if the access fails, to try 'lstat' instead. Could you test what happens if you replace if (Tcl_Access .. == 0) by 'if (Tcl_LStat(..) == 0)'? (or something like that).... - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [48eaa464ca] (rid 99978) by lvirden on 2001-08-20 17:13:29:
- icomment:
Logged In: YES user_id=15949 Unfortunately, I wasn't able to figure out how to add the code. Tcl_FSLstat takes an TclObj for a pathname and I don't have the background to figure out how to create one of those... If someone can come up with a patch, I can test it out - I provided a simple script in the original bug report for recreating the problem on at least SPARC Solaris... I wasn't aware that the bug didn't exist everywhere.
- login: "lvirden"
- mimetype: "text/plain"
- username: "lvirden"
- icomment:
Ticket change [c71f0c1cf1] (rid 121883) by vincentdarley on 2001-08-20 18:08:58:
- icomment:
Logged In: YES user_id=32170 Could you test this: case TCL_PLATFORM_UNIX: { Tcl_Obj *nameObj; struct stat buf; if (Tcl_DStringLength(headPtr) == 0) { if ((*name == '\\' && name[1] == '/') || (*name == '/')) { Tcl_DStringAppend(headPtr, "/", 1); } else { Tcl_DStringAppend(headPtr, ".", 1); } } nameObj = Tcl_NewStringObj(Tcl_DStringValue(headPtr), Tcl_DStringLength(headPtr)); if (Tcl_FSLstat(nameObj, &buf) == 0) { Tcl_ListObjAppendElement(interp, Tcl_GetObjResult (interp), nameObj); } else { Tcl_DecrRefCount(nameObj); } break; } - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [4e3260c2de] (rid 127181) by lvirden on 2001-08-20 18:40:09:
- icomment:
Logged In: YES user_id=15949 I have made the change you requested. However, it doesn't fix the problem: $ tclsh % glob /tmp/notthere* /tmp/notthere % glob /tmp/notthere no files matched glob pattern "/tmp/notthere" Note there is one difference - now the message no longer says "while evaluating {glob /tmp/notthere}"; I have no idea why that is now missing! - login: "lvirden"
- mimetype: "text/plain"
- username: "lvirden"
- icomment:
Ticket change [439e8680cc] (rid 116594) by vincentdarley on 2001-08-20 18:42:38:
- icomment:
Logged In: YES user_id=32170 Actually the patch I gave below can segfault under some circumstances. This is better: Tcl_Obj *nameObj; struct stat buf; if (Tcl_DStringLength(headPtr) == 0) { if ((*name == '\\' && name[1] == '/') || (*name == '/')) { Tcl_DStringAppend(headPtr, "/", 1); } else { Tcl_DStringAppend(headPtr, ".", 1); } } nameObj = Tcl_NewStringObj(Tcl_DStringValue (headPtr), Tcl_DStringLength (headPtr)); Tcl_IncrRefCount(nameObj); if (Tcl_FSLstat(nameObj, &buf) == 0) { Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp), nameObj); } Tcl_DecrRefCount(nameObj); break; - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [e30fae774b] (rid 87724) by lvirden on 2001-08-20 19:57:03:
- icomment:
Logged In: YES user_id=15949 even with your improved patch, the glob continues to work in the same fashion as it did.
- login: "lvirden"
- mimetype: "text/plain"
- username: "lvirden"
- icomment:
Ticket change [83460b8d9a] (rid 117361) by dkf on 2001-08-20 21:14:52:
- assignee changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=79902 Vince, with your later change it works exactly as advertised for me under Solaris; I cannot reproduce Larry's problem. Should this (corrected) behaviour and its fix be propagated through to the other platforms too? (I suppose if they can have broken links...) Would that allow any refactoring of code?
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [f585d91a32] (rid 130123) by nobody on 2001-08-20 21:16:24:
- icomment:
Logged In: NO I've found a sunos machine I have access to, on which this fails, and have tried my patch below. It works for me: sfi ~> ls -l bbb lrwxrwxrwx 1 vince info 3 Aug 20 08:05 bbb - > aaa sfi ~> ls -l aaa ls: aaa: No such file or directory Exit 1 sfi ~> ./tcl/tcl/unix/tclsh % info patchlevel 8.4a4 % parray tcl_platform tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.7 tcl_platform(platform) = unix tcl_platform(user) = vince % glob bbb* bbb % glob bbb bbb % Or, to give an example closer to yours: % ln -s foo /tmp/notthere % glob /tmp/notthere /tmp/notthere I think this means you've got a problem with the wrong version of Tcl being picked up in your testing. Unless there are strenuous objections I'll mark this bug closed when I apply the patch (along with a variety of other fs changes) -- Vince..
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [6c9f603fe0] (rid 128545) by lvirden on 2001-08-20 21:20:01:
- icomment:
Logged In: YES user_id=15949 I just tried from a different computer (same install image) and I see it working from there as well. So it should be fine to make this one closed.
- login: "lvirden"
- mimetype: "text/plain"
- username: "lvirden"
- icomment:
Ticket change [8492e85d3e] (rid 117576) by nobody on 2001-08-20 23:33:33:
- icomment:
Logged In: NO Responding to dkf below, yes this does allow refactoring of some code, which I've now done. The end of TclDoGlob is now a bit simpler, and more code is shared. I'm working on a variety of other small filesystem issues and will commit the patch when a few other things are done -- Vince.
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [949bbcb15a] (rid 106021) by vincentdarley on 2001-08-24 01:26:50:
- closedate changed to: "2001-08-23T18:26:50"
- closer changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=32170 Fixed in cvs head
- login: "vincentdarley"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "vincentdarley"