#1992: 6.8.2 intermittent build failure on multiple OS X versions
----------------------+-----------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: closed
Priority: normal | Milestone: 6.8.3
Component: Compiler | Version: 6.8.2
Severity: normal | Resolution: duplicate
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Multiple
Os: MacOS X |
----------------------+-----------------------------------------------------
Comment (by gw):
Having looked at it again, the test "if (lookupHashTable(fd_hash, fd) ==
NULL)" is not
probably not necessary, as long as we can guarantee that no fd will
attempt to lock
twice. A belt and suspenders approach is
{{{
--- /Users/gwright/src/macports-
trunk/dports/lang/ghc/work/ghc-6.8.2/rts/posix/FileLock.c.sav 2008-03-03
11:40:14.000000000 -0500
+++ /Users/gwright/src/macports-
trunk/dports/lang/ghc/work/ghc-6.8.2/rts/posix/FileLock.c 2008-03-03
11:43:40.000000000 -0500
@@ -88,6 +88,17 @@
if (for_writing || lock->readers < 0) {
return -1;
}
+
+ // have we seen this fd before?
+ if (lookupHashTable(fd_hash, fd) == NULL) {
+ insertHashTable(fd_hash, fd);
+ }
+ else
+ {
+ errorBelch("fd %d tries to lock the same file twice", fd);
+ return -1;
+ }
+
lock->readers++;
return 0;
}
}}}
I'm using this in the new macports 6.8.2 until I can convince myself that
double locking is really impossible.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1992#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs