move gpg tmp home to system temp dir
test: Put gpg temp home directory in system temp directory, not filesystem being tested. Since I've found indications gpg can fail talking to the agent when the socket ends up on eg, fat. And to hopefully fix this bug report I've followed up on. The main risk in using the system temp dir is that TMPDIR could be set to a long directory path, which is too long to put a unix socket in. To partially amelorate that risk, it uses either an absolute or a relative path, whichever is shorter. (Hopefully gpg will not convert it to a longer form of the path..) If the user sets TMPDIR to something so long a path to it + "S.gpg-agent" is too long, I suppose that's their issue to deal with. Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
b7d5d54b06
commit
c2a44eab50
3 changed files with 74 additions and 7 deletions
21
Test.hs
21
Test.hs
|
@ -1821,13 +1821,20 @@ test_crypto = do
|
|||
testscheme "pubkey"
|
||||
where
|
||||
gpgcmd = Utility.Gpg.mkGpgCmd Nothing
|
||||
testscheme scheme = do
|
||||
abstmp <- fromRawFilePath <$> absPath (toRawFilePath tmpdir)
|
||||
testscheme' scheme abstmp
|
||||
testscheme' scheme abstmp = intmpclonerepo $ do
|
||||
gpgtmp <- (</> "gpgtmp") . fromRawFilePath
|
||||
<$> relPathCwdToFile (toRawFilePath abstmp)
|
||||
createDirectoryIfMissing False gpgtmp
|
||||
testscheme scheme = Utility.Tmp.Dir.withTmpDir "gpgtmp" $ \gpgtmp -> do
|
||||
-- Use the system temp directory as gpg temp directory because
|
||||
-- it needs to be able to store the agent socket there,
|
||||
-- which can be problimatic when testing some filesystems.
|
||||
absgpgtmp <- fromRawFilePath <$> absPath (toRawFilePath gpgtmp)
|
||||
testscheme' scheme absgpgtmp
|
||||
testscheme' scheme absgpgtmp = intmpclonerepo $ do
|
||||
-- Since gpg uses a unix socket, which is limited to a
|
||||
-- short path, use whichever is shorter of absolute
|
||||
-- or relative path.
|
||||
relgpgtmp <- fromRawFilePath <$> relPathCwdToFile (toRawFilePath absgpgtmp)
|
||||
let gpgtmp = if length relgpgtmp < length absgpgtmp
|
||||
then relgpgtmp
|
||||
else absgpgtmp
|
||||
Utility.Gpg.testTestHarness gpgtmp gpgcmd
|
||||
@? "test harness self-test failed"
|
||||
void $ Utility.Gpg.testHarness gpgtmp gpgcmd $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue