From: Joey Hess Date: Wed, 10 Jan 2024 21:31:58 +0000 (-0400) Subject: close send side of password pipe on exec X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~29^2~50 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=790600f7b2303bb7b201975598a80fb4672aa391;p=git-annex.git close send side of password pipe on exec This avoids a hang approximately 1% of the time when running the test suite on StatelessOpenPGP. Since I've not seen git-annex hang when running git like that, I guess git probably does something that avoids hanging similarly. Still, fixed the same problem in Utility.Gpg too. Sponsored-by: Kevin Mueller on Patreon --- diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index 54521fbedf..2ef077990f 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -163,6 +163,7 @@ feedRead cmd params passphrase feeder reader = do let setup = liftIO $ do -- pipe the passphrase into gpg on a fd (frompipe, topipe) <- System.Posix.IO.createPipe + setFdOption topipe CloseOnExec True toh <- fdToHandle topipe t <- async $ do B.hPutStr toh (passphrase <> "\n") diff --git a/Utility/StatelessOpenPGP.hs b/Utility/StatelessOpenPGP.hs index dfee3ec3c5..73e3746a3a 100644 --- a/Utility/StatelessOpenPGP.hs +++ b/Utility/StatelessOpenPGP.hs @@ -133,6 +133,7 @@ feedRead cmd subcmd params password emptydirectory feeder reader = do let setup = liftIO $ do -- pipe the passphrase in on a fd (frompipe, topipe) <- System.Posix.IO.createPipe + setFdOption topipe CloseOnExec True toh <- fdToHandle topipe t <- async $ do B.hPutStr toh (password <> "\n")