Artifacts Associated With Ticket 723502ffffffffff
Ticket change [4f2d9d7472] (rid 125780) by peterdrexel on 2003-04-18 05:04:31:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Version: TCL 8.4.2 OS: Mac OSX 10.1.5 (or any platform where TCL_THREADS is defined) Behavior: Directory entries are not read correctly when TCL commands such as glob are used. Instead the result indicates that no entries could be found. Expected Behavior: glob *.o should return a list of .o files within a directory (it there are any of course) The last argument in the call to memcpy in the function TclpReaddir in source file tclUnixThrd.c is incorrect. The sizeof operator is applied to the address of the item being copied instead of the item itself and consequently only a fraction of the necessary directory information is being copied. 8.4.2 code: memcpy((VOID *) &tsdPtr->rdbuf.ent, (VOID *) ent, sizeof(&tsdPtr->rdbuf)); should read: memcpy((VOID *) &tsdPtr->rdbuf.ent, (VOID *) ent, sizeof(tsdPtr->rdbuf)); - foundin initialized to: "obsolete: 8.4.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "peterdrexel"
- subsystem initialized to: "49. Threading"
- title initialized to: "Directory Read Bug w/TCL_THREADS"
- type initialized to: "Bug"
Add attachment "tclUnixThrd.c" [3c77d4dadc] (rid 120922) by peterdrexel on 2003-04-18 12:04:31.
Ticket change [c7d0056730] (rid 122005) by peterdrexel on 2003-04-18 12:04:31:
- icomment:
File Added - 48090: tclUnixThrd.c
- login: "peterdrexel"
- mimetype: "text/plain"
- username: "peterdrexel"
- icomment:
Ticket change [c3010178e1] (rid 111583) by hobbs on 2003-04-19 02:09:54:
- assignee changed to: "das"
- priority changed to: "7 High"
Ticket change [005ac6d072] (rid 119308) by hobbs on 2003-05-11 07:04:06:
- assignee changed to: "vasiljevic"
- priority changed to: "8"
Ticket change [ca51c8eb0c] (rid 95324) by vasiljevic on 2003-05-12 14:52:13:
- icomment:
Logged In: YES user_id=95086 Well, this is happening for older 10.1.xxx OSX since newer ones have readdir_r already. But the bug report is correct, i.e. there is a mistake in the code, as described. I will correct this in both CVS HEAD and in 8.4 branch if nobody objects. Th problem is: even the newer readdir_r with its opendir/closedir companions is broken for MT. I will have to avait the new OSX update and if it shows same problems, I might talk to Daniel Steffen and Jim Ingham how best to correct that. Zoran
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [2e9bc0fde7] (rid 92924) by das on 2003-05-12 15:00:26:
- priority changed to: "9 Immediate"
Ticket change [b271b24626] (rid 98336) by das on 2003-05-12 15:00:27:
- icomment:
Logged In: YES user_id=90580 Zoran, could you check this soon so that it makes it into 8.4.3 (or I can do it if you prefer), 8.4.2 is completely broken on 10.1 due to this... are you saying that we should use the tcl provided version of readdir_r on 10.2 and later as well (similar to what we need to do for realpath in bug 711232)?
- login: "das"
- mimetype: "text/plain"
- username: "das"
- icomment:
Ticket change [24000ca540] (rid 131031) by das on 2003-05-12 15:10:48:
- icomment:
Logged In: YES user_id=90580 oops, I meant "check this in", not "check this"...
- login: "das"
- mimetype: "text/plain"
- username: "das"
- icomment:
Ticket change [c512361917] (rid 111933) by vasiljevic on 2003-05-12 15:14:40:
- icomment:
Logged In: YES user_id=95086 Oh yes. The readdir_r in 10.2 (at least the version I have) is also broken when multiple threads are engaged in file tree walks. The problem is difficult to reproduce (as with all MT problems, phew) but it's there. We have our own kind of "find" utility employing MT and written for the AOLserver. Now, for that, I had to write my own readdir/opendir/closedir wrappers. I hope to see the problem solved with the new release of MacOSX. If not, we must/should do something there as well. I wouldn't rush, though, because most of the people won't hit this one. Speaking of 10.1 bug, it is ok. I will correct it in the CVS now. Zoran.
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [f5888e7e3f] (rid 130127) by das on 2003-05-12 15:19:41:
- icomment:
Logged In: YES user_id=90580 oy, that's bad, the point of _r in readdir_r is supposed to be that it's thread safe... I hope you have reported this as a bug to Apple? Given that I have to do something for realpath in the makesystem already, I'll see about removing HAVE_READDIR_R as well so that the tcl version gets used.
- login: "das"
- mimetype: "text/plain"
- username: "das"
- icomment:
Ticket change [437a60c101] (rid 116559) by vasiljevic on 2003-05-12 15:32:28:
- icomment:
Logged In: YES user_id=95086 Well, the readdir_r is supposed to be thread-safe, but on osx, when many threads are doing: opendir readdir_r closedir in parallel, you get memory corruption in closedir after a while. What I did was wrap all those with my own wrappers with my_opendir doing the actual opendir, slurping all dir entries in an linked list with readdir_r and my_readdir simply traversing this list. The my_closedir frees the whole thing. All work of my_opendir is done under mutex protection. This was the only way I could solve the memory-trashing, which happens otherwise. I'm not sure you can plug this into Tcl current layout easily. That's why I suggest to wait for Apple to catch up and update the OS and correct the bug. No; I haven't posted a bug to Apple yet. Somehow I have a very bad feeling about that (i.e. waste of time) judging from my own previous experiences with the company. But I may be wrong and things may have changed since... Zoran
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [f569679a03] (rid 130102) by das on 2003-05-12 15:42:00:
- icomment:
Logged In: YES user_id=90580 so does this mean that the code in tclUnixThrd.c fails on OS X even if HAVE_READDIR_R is not defined due to the opendir/ closedir bug? I have had good experiences with bug reports to http://bugreporter.apple.com but I fear it may already be too late now to get a fix into 10.3, you should ask if this bug is known and if it will be fixed in 10.3 on the darwin developers list http://www.lists.apple.com/mailman/listinfo/darwin-development many apple engineers working at the libc level hang out there. Might be useful to mention the realpath issue as well.
- login: "das"
- mimetype: "text/plain"
- username: "das"
- icomment:
Ticket change [507517269f] (rid 125971) by vasiljevic on 2003-05-12 15:54:01:
- icomment:
Logged In: YES user_id=95086 I can't say for sure, without actually testing this, but I suppose yes, it will break. So, the better way, as I said is to try the regular bug-report path. I will try the bugreporter.apple.com. Lets see how this works. BTW, this one is now fixed both in 8.4 branch and in head. Zoran
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [64b1b62114] (rid 92814) by hobbs on 2003-05-15 00:38:16:
- closedate changed to: "2003-05-14T17:38:16"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 Closing as Zoran noted it was fixed.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "hobbs"