diff options
| author | Gleb Popov <arrowd@FreeBSD.org> | 2026-03-08 19:47:05 +0000 |
|---|---|---|
| committer | Gleb Popov <arrowd@FreeBSD.org> | 2026-03-09 07:03:51 +0000 |
| commit | 98214c958ae1eb4c552dd9f446287395e337c076 (patch) | |
| tree | 3b34efb4c8ed0b4794f33928536cd476ee23dff9 | |
| parent | 4fcfa3f6b13d9cbf379f63da74ca8b3e730747ae (diff) | |
lang/ghc: Add patch fixing the semaphore-compat package
| -rw-r--r-- | lang/ghc/Makefile | 2 | ||||
| -rw-r--r-- | lang/ghc/files/patch-libraries_semaphore-compat_src_System_Semaphore.hs | 44 |
2 files changed, 45 insertions, 1 deletions
diff --git a/lang/ghc/Makefile b/lang/ghc/Makefile index 2f7372af499e..bf68f31f513d 100644 --- a/lang/ghc/Makefile +++ b/lang/ghc/Makefile @@ -1,6 +1,6 @@ PORTNAME= ghc PORTVERSION= ${GHC_VERSION} -PORTREVISION?= 1 +PORTREVISION?= 2 CATEGORIES= lang haskell MASTER_SITES= https://www.haskell.org/ghc/dist/${PORTVERSION}/:source \ LOCAL/arrowd/:boot diff --git a/lang/ghc/files/patch-libraries_semaphore-compat_src_System_Semaphore.hs b/lang/ghc/files/patch-libraries_semaphore-compat_src_System_Semaphore.hs new file mode 100644 index 000000000000..75e3f07b62c5 --- /dev/null +++ b/lang/ghc/files/patch-libraries_semaphore-compat_src_System_Semaphore.hs @@ -0,0 +1,44 @@ +--- libraries/semaphore-compat/src/System/Semaphore.hs.orig 2025-09-10 16:05:58 UTC ++++ libraries/semaphore-compat/src/System/Semaphore.hs +@@ -138,7 +138,7 @@ create_sem sem_str init_toks = do + { Posix.semCreate = True + , Posix.semExclusive = True } + mb_sem <- MC.try @_ @MC.SomeException $ +- Posix.semOpen sem_str flags Posix.stdFileMode init_toks ++ Posix.semOpen (fixedUpName sem_str) flags Posix.stdFileMode init_toks + return $ case mb_sem of + Left err -> Left $ MC.throwM err + Right sem -> Right $ mk_sem sem +@@ -162,7 +162,7 @@ openSemaphore nm@(SemaphoreName sem_name) = do + flags = Posix.OpenSemFlags + { Posix.semCreate = False + , Posix.semExclusive = False } +- sem <- Posix.semOpen sem_name flags Posix.stdFileMode 0 ++ sem <- Posix.semOpen (fixedUpName sem_name) flags Posix.stdFileMode 0 + #endif + return $ + Semaphore +@@ -216,7 +216,7 @@ destroySemaphore sem = + #if defined(mingw32_HOST_OS) + Win32.closeHandle (Win32.semaphoreHandle $ semaphore sem) + #else +- Posix.semUnlink (getSemaphoreName $ semaphoreName sem) ++ Posix.semUnlink (fixedUpName $ getSemaphoreName $ semaphoreName sem) + #endif + + -- | Query the current semaphore value (how many tokens it has available). +@@ -351,3 +351,14 @@ random_strings = do + CClock t <- Posix.systemTime <$> Posix.getProcessTimes + #endif + return $ fmap ( \ i -> iToBase62 (i + fromIntegral t) ) (0 :| [1..]) ++ ++fixedUpName :: String -> String ++#if !defined(freebsd_HOST_OS) ++fixedUpName = id ++#else ++-- On FreeBSD the semaphore name has to start with '/' ++-- and not have any more '/' inside ++fixedUpName ('/':rest) = '/' : filter (/= '/') rest ++fixedUpName (notSlash:rest) = '/':notSlash:filter (/= '/') rest ++fixedUpName n = n ++#endif |
