|
2003-05-15
| ||
| 00:38 | • Closed ticket [723502ffff]: Directory Read Bug w/TCL_THREADS plus 7 other ch... artifact: 64b1b62114 user: hobbs | |
|
2003-05-12
| ||
| 15:54 | • Ticket [723502ffff]: 4 changes artifact: 507517269f user: vasiljevic | |
| 15:42 | • Ticket [723502ffff]: 4 changes artifact: f569679a03 user: das | |
| 15:32 | • Ticket [723502ffff]: 4 changes artifact: 437a60c101 user: vasiljevic | |
| 15:19 | • Ticket [723502ffff]: 4 changes artifact: f5888e7e3f user: das | |
| 15:14 | • Ticket [723502ffff]: 4 changes artifact: c512361917 user: vasiljevic | |
| 15:10 | • Ticket [723502ffff]: 4 changes artifact: 24000ca540 user: das | |
| 15:00 | • Ticket [723502ffff]: 4 changes artifact: b271b24626 user: das | |
| 15:00 | • Ticket [723502ffff]: 1 change artifact: 2e9bc0fde7 user: das | |
| 14:52 | • Ticket [723502ffff]: 4 changes artifact: ca51c8eb0c user: vasiljevic | |
|
2003-05-11
| ||
| 07:04 | • Ticket [723502ffff]: 2 changes artifact: 005ac6d072 user: hobbs | |
|
2003-04-19
| ||
| 02:09 | • Ticket [723502ffff]: 2 changes artifact: c3010178e1 user: hobbs | |
|
2003-04-18
| ||
| 12:04 | • Add attachment tclUnixThrd.c to ticket [723502ffff] artifact: 3c77d4dadc user: peterdrexel | |
| 12:04 | • Ticket [723502ffff] Directory Read Bug w/TCL_THREADS status still Open with ... artifact: c7d0056730 user: peterdrexel | |
| 05:04 | • New ticket [723502ffff]. artifact: 4f2d9d7472 user: peterdrexel | |
Directory Read Bug w/TCL_THREADS
Closed / Fixed723502ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-04-18 05:04:31
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));
peterdrexelplain2003-04-18 12:04:31
File Added - 48090: tclUnixThrd.c
hobbs Ticket [723502ffff]: 2 changes
[History diff]2003-04-19 02:09:54
hobbs Ticket [723502ffff]: 2 changes
[History diff]2003-05-11 07:04:06
vasiljevicplain2003-05-12 14:52:13
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
das Ticket [723502ffff]: 1 change
[History diff]2003-05-12 15:00:26
dasplain2003-05-12 15:00:27
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)?
dasplain2003-05-12 15:10:48
Logged In: YES user_id=90580 oops, I meant "check this in", not "check this"...
vasiljevicplain2003-05-12 15:14:40
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.
dasplain2003-05-12 15:19:41
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.
vasiljevicplain2003-05-12 15:32:28
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
dasplain2003-05-12 15:42:00
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.
vasiljevicplain2003-05-12 15:54:01
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
hobbsplain2003-05-15 00:38:16
Logged In: YES user_id=72656 Closing as Zoran noted it was fixed.
Log in (anonymous is fine) to add a comment.
Attachments:
- tclUnixThrd.c [download] added by peterdrexel on 2003-04-18 12:04:31. [details]