Make test suite work better when the temp directory is on NFS.

Deleting directories is one of the great unsolved problems of CS, thanks to
abominations like NFS lock files and Windows and races with other processes
cleaning up after themselves in the background. The gpg test harness
sometimes failed to delete its temp directory on NFS. Avoid the problem
class by not deleting it at all, and putting it inside the tmp repo being
tested. The test suite's more robust (and/or nonsensical) workarounds for
deleting its test dir will thus be used, hopefully avoiding the problem
until an OS finds a new way to violate POSIX and the laws of nature.

Note that this means that the .gnupg directory will be on whatever
filesystem the test suite is being run on, which may be a lesser quality
filesystem than gpg is really expecting. Gpg does not seem to need to
write sockets etc to there so this seems ok. The only known problem is
that if the filesystem forces a directory mode like 777, gpg will warn
about unsafe home directory perms, but it still works.
This commit is contained in:
Joey Hess 2018-12-19 11:56:39 -04:00
parent 29b3d71122
commit 14971414dc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 30 additions and 22 deletions

View file

@ -60,6 +60,7 @@ import qualified Annex.WorkTree
import qualified Annex.Init
import qualified Annex.CatFile
import qualified Annex.Path
import qualified Annex.Perms
import qualified Annex.VectorClock
import qualified Annex.View
import qualified Annex.View.ViewedFile
@ -1620,9 +1621,12 @@ test_crypto = do
where
gpgcmd = Utility.Gpg.mkGpgCmd Nothing
testscheme scheme = intmpclonerepo $ whenM (Utility.Path.inPath (Utility.Gpg.unGpgCmd gpgcmd)) $ do
Utility.Gpg.testTestHarness gpgcmd
gpgtmpdir <- annexeval $ (</> "gpgtest")
<$> Annex.fromRepo Annex.Locations.gitAnnexTmpMiscDir
annexeval $ Annex.Perms.createAnnexDirectory gpgtmpdir
Utility.Gpg.testTestHarness gpgtmpdir gpgcmd
@? "test harness self-test failed"
Utility.Gpg.testHarness gpgcmd $ do
Utility.Gpg.testHarness gpgtmpdir gpgcmd $ do
createDirectory "dir"
let a cmd = git_annex cmd $
[ "foo"