From nobody Mon Sep 23 08:28:49 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XBx3P5Ddhz5X6R4; Mon, 23 Sep 2024 08:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XBx3P4Pkxz4PZ3; Mon, 23 Sep 2024 08:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727080129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X8rtDVSSpXDUADEQefIzRV4SR8RV1WhTyLc2ApKN3+U=; b=bobbPnQGYNEotL9Ho2oMwYKBHzh2dHEPK1lApmIoflYdjqwNYihjgqMDe8XZIXeribQBjb teAs54pWgA1L1UfAl4C24nsXnyKlvfRpBU0MyOjUBhxksfbRbvIhxEzie5wB6TNbXZU3bW Ki6Fo87HL9Rjjf54+E22gp6IeZMNCFLM+mhnqo6PTpAHXxDGIkndjed3sqQOLLogmdKh6x wiJ8eIGgn2tN3Y5Jysll5oo49I5DqlqKKRK5sTLwIWeXbnVO9IDt3VolqkP8XMwoDje7Ge JVwDx8UxfV/di3VxF7RJATcUmMxrzXBJT6W2dw6j2GvWwXbnpUuekCruCx5yHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727080129; a=rsa-sha256; cv=none; b=mj9NbnkMW6hUqDovveaAHFaU6Ft1lK7klKxVlEkUbbpKPq66xPZX5eJ38ZWq0CyB++ToLd uP4qhGidXxD54ZUuGlalmrohIm8Sd+p3RgHRI2I9qcCxGdVNlNtJswbitp/kvm+HP5nxjE +nX1BGnQJK7Kcw0wu1MFASm2nmDcwyBxIwjpEqckDklCHm3nZ5Zqn3El6GcWdNpST9mreT XGR5EjU9j82ZN5pL0EMaJA32XulhsS59FMrYauKZi39u6QGsJF2pOx5h2t/7+v8QWb40ci iigXGrqePSZ44YXUfdXPWD8zJ3H2+UbthpdEqkB6sT20IalyleHUyBSlQPPRhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727080129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X8rtDVSSpXDUADEQefIzRV4SR8RV1WhTyLc2ApKN3+U=; b=w2isvBo/WIJuVDtpLZ/htf9CClTMS1/Az9Sq41ZKPA+mIrb0OPq3vE038MNdID/QZRoocz 2ODkIJEOOkuCtAYXxuYRfkhK79kfCqzUIh/dfWzHLJqVkQiQxwbRuMiiAVWRE+NC38OmHH l+3uZWAYXhVjyQ+wkUcAIjA9iwQSm11y1NU703RJ2P185ShyHMY7iJhSFhj1fVRYctYq2v uYEy+ECFUZZqLm/LaRWCEWI8Qgs0oRdDhc2/77UNUxsTAnt/0J2il6hddEV+RaF26uxmFv UKNYZlN6ryM6fLSh8dc7WRIleFXfW5Dhb1uRKHqczfzYMIK7GIjPPPrS52Wnvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XBx3P3jM3zcrH; Mon, 23 Sep 2024 08:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48N8Sn7F031421; Mon, 23 Sep 2024 08:28:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48N8SnvF031418; Mon, 23 Sep 2024 08:28:49 GMT (envelope-from git) Date: Mon, 23 Sep 2024 08:28:49 GMT Message-Id: <202409230828.48N8SnvF031418@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Gleb Popov Subject: git: 838c356b1752 - main - lang/ghc: Pull a patch from upstream fixing a forking bug List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 838c356b1752e1cb73bb21bfa7710e1dcbc22b2b Auto-Submitted: auto-generated The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=838c356b1752e1cb73bb21bfa7710e1dcbc22b2b commit 838c356b1752e1cb73bb21bfa7710e1dcbc22b2b Author: Gleb Popov AuthorDate: 2024-09-23 08:27:34 +0000 Commit: Gleb Popov CommitDate: 2024-09-23 08:28:44 +0000 lang/ghc: Pull a patch from upstream fixing a forking bug --- lang/ghc/Makefile | 2 +- .../patch-libraries_base_GHC_Event_KQueue.hsc | 45 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/lang/ghc/Makefile b/lang/ghc/Makefile index ff93d9d2b7a7..a61a0477f0e3 100644 --- a/lang/ghc/Makefile +++ b/lang/ghc/Makefile @@ -1,6 +1,6 @@ PORTNAME= ghc PORTVERSION= ${GHC_VERSION} -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES= lang haskell MASTER_SITES= https://www.haskell.org/ghc/dist/${PORTVERSION}/:source \ LOCAL/arrowd/:boot diff --git a/lang/ghc/files/patch-libraries_base_GHC_Event_KQueue.hsc b/lang/ghc/files/patch-libraries_base_GHC_Event_KQueue.hsc new file mode 100644 index 000000000000..1413a39d9705 --- /dev/null +++ b/lang/ghc/files/patch-libraries_base_GHC_Event_KQueue.hsc @@ -0,0 +1,45 @@ +https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13276 + +--- libraries/base/GHC/Event/KQueue.hsc.orig 2024-06-30 22:49:26 UTC ++++ libraries/base/GHC/Event/KQueue.hsc +@@ -44,8 +44,8 @@ import GHC.Event.Internal (Timeout(..)) + import GHC.Real (quotRem, fromIntegral) + import GHC.Show (Show(show)) + import GHC.Event.Internal (Timeout(..)) +-import System.Posix.Internals (c_close) +-import System.Posix.Types (Fd(..)) ++import System.Posix.Internals (c_close, c_getpid) ++import System.Posix.Types (Fd(..), CPid) + import qualified GHC.Event.Array as A + + #if defined(netbsd_HOST_OS) +@@ -73,19 +73,26 @@ data KQueue = KQueue { + data KQueue = KQueue { + kqueueFd :: {-# UNPACK #-} !KQueueFd + , kqueueEvents :: {-# UNPACK #-} !(A.Array Event) ++ , kqueuePid :: {-# UNPACK #-} !CPid -- ^ pid, used to detect forks + } + + new :: IO E.Backend + new = do + kqfd <- kqueue + events <- A.new 64 +- let !be = E.backend poll modifyFd modifyFdOnce delete (KQueue kqfd events) ++ pid <- c_getpid ++ let !be = E.backend poll modifyFd modifyFdOnce delete (KQueue kqfd events pid) + return be + + delete :: KQueue -> IO () + delete kq = do +- _ <- c_close . fromKQueueFd . kqueueFd $ kq +- return () ++ -- detect forks: the queue isn't inherited by a child process created with ++ -- fork. Hence we mustn't try to close the old fd or we might close a random ++ -- one (e.g. the one used by timerfd, cf #24672). ++ pid <- c_getpid ++ when (pid == kqueuePid kq) $ do ++ _ <- c_close . fromKQueueFd . kqueueFd $ kq ++ return () + + modifyFd :: KQueue -> Fd -> E.Event -> E.Event -> IO Bool + modifyFd kq fd oevt nevt = do