[Mono-bugs] [Bug 74649][Min] Changed - NUnit test in corlib fails

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 21 Apr 2005 13:34:15 -0400 (EDT)

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by flashdict@gmail.com.


--- shadow/74649	2005-04-21 10:00:11.000000000 -0400
+++ shadow/74649.tmp.23630	2005-04-21 13:34:15.000000000 -0400
@@ -220,6 +220,52 @@
 Your bug is stating that there are items in the share table with
 refs==0, and someone is trying to release them again.  The bug
 requires figuring out how the refs managed to get to 0 without the
 entry being deleted.
+------- Additional Comments From flashdict@gmail.com  2005-04-21 13:34 -------
+I believe I've got it, Dick.  Thanks for your patience.
+The problem is in the second call to share_allows_open() within
+share_check(), which is called by CreateFile().  The first call
+correctly returns FALSE, but then in between the first and second
+calls to share_check(), a call to suspect routine, 
+_wapi_handle_check_share() is made, and since FreeBSD _has_ a /proc,
+but does not have a /proc/XXX/fd, nothing is ever found in the readdir
+loop which checks the symlinks,  and we wind up at:
+if (found == FALSE)  {
+       /* Blank out this entry, as it is stale */
+in _wapi_handle_check_share(), which does just that.  The second call
+to share_allows_open() then succeeds, since the handle memory is now
+nullied, and we get a new handle and return TRUE to CreateFile(),
+instead of still violating.
+The following small patch fixes things, at least until we can work out
+a way to do the secondary check on FreeBSD.
+Index: handles.c
+--- handles.c   (revision 43311)
++++ handles.c   (working copy)
+@@ -1588,12 +1588,15 @@
+        int pid;
+        guint32 now = (guint32)(time(NULL) & 0xFFFFFFFF);
+        int thr_ret;
++#ifdef __FreeBSD__
+        proc_dir = opendir ("/proc");
+        if (proc_dir == NULL) {
+                return;
+        }