summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-29 14:58:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-29 15:08:18 -0400
commit49ea9c99164e052dc0c66750c822d350d62a547e (patch)
tree896909e90ebd21deca6b2d8359dae9c188e28d35
parentab1ff5b7f3e558e0277edccf46cf9c9e5c0675e1 (diff)
test: Fix reversion that made it only run inside a git repository.
Using annexeval to run probeCrippledFileSystem' caused Git.CurrentRepo.get to be run. Fixed easily since probeCrippledFileSystem' had no need to use the Annex monad. This commit was sponsored by Ethan Aubin.
-rw-r--r--Annex/Init.hs42
-rw-r--r--CHANGELOG1
-rw-r--r--Test.hs2
-rw-r--r--doc/bugs/git_annex_test_fails/comment_1_5e107e34b28a48c16d1240ea02d09439._comment20
4 files changed, 43 insertions, 22 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs
index aec926ecf..9a284e62b 100644
--- a/Annex/Init.hs
+++ b/Annex/Init.hs
@@ -146,40 +146,40 @@ probeCrippledFileSystem :: Annex Bool
probeCrippledFileSystem = do
tmp <- fromRepo gitAnnexTmpMiscDir
createAnnexDirectory tmp
- probeCrippledFileSystem' tmp
+ (r, warnings) <- liftIO $ probeCrippledFileSystem' tmp
+ mapM_ warning warnings
+ return r
-probeCrippledFileSystem' :: FilePath -> Annex Bool
+probeCrippledFileSystem' :: FilePath -> IO (Bool, [String])
#ifdef mingw32_HOST_OS
probeCrippledFileSystem' _ = return True
#else
probeCrippledFileSystem' tmp = do
let f = tmp </> "gaprobe"
- liftIO $ writeFile f ""
- uncrippled <- probe f
- void $ liftIO $ tryIO $ allowWrite f
- liftIO $ removeFile f
- return $ not uncrippled
+ writeFile f ""
+ r <- probe f
+ void $ tryIO $ allowWrite f
+ removeFile f
+ return r
where
- probe f = catchBoolIO $ do
+ probe f = catchDefaultIO (True, []) $ do
let f2 = f ++ "2"
- liftIO $ nukeFile f2
- liftIO $ createSymbolicLink f f2
- liftIO $ nukeFile f2
- liftIO $ preventWrite f
+ nukeFile f2
+ createSymbolicLink f f2
+ nukeFile f2
+ preventWrite f
-- Should be unable to write to the file, unless
-- running as root, but some crippled
-- filesystems ignore write bit removals.
- ifM ((== 0) <$> liftIO getRealUserID)
- ( return True
+ ifM ((== 0) <$> getRealUserID)
+ ( return (False, [])
, do
- r <- liftIO $ catchBoolIO $
- writeFile f "2" >> return True
+ r <- catchBoolIO $ do
+ writeFile f "2"
+ return True
if r
- then do
- warning "Filesystem allows writing to files whose write bit is not set."
- return False
- else return True
-
+ then return (True, ["Filesystem allows writing to files whose write bit is not set."])
+ else return (False, [])
)
#endif
diff --git a/CHANGELOG b/CHANGELOG
index 8ae15e404..d1c23953c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@ git-annex (6.20170926) UNRELEASED; urgency=medium
could be output, which messed up the expected output for --batch mode.
* external: Avoid checking EXPORTSUPPORTED for special remotes that are
not configured to use exports.
+ * test: Fix reversion that made it only run inside a git repository.
-- Joey Hess <id@joeyh.name> Thu, 28 Sep 2017 12:01:39 -0400
diff --git a/Test.hs b/Test.hs
index 075f65e6a..5c3f362b5 100644
--- a/Test.hs
+++ b/Test.hs
@@ -147,7 +147,7 @@ runner = Just go
exitWith exitcode
runsubprocesstests opts (Just _) = isolateGitConfig $ do
ensuretmpdir
- crippledfilesystem <- annexeval $ Annex.Init.probeCrippledFileSystem' tmpdir
+ crippledfilesystem <- fst <$> Annex.Init.probeCrippledFileSystem' tmpdir
case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of
Nothing -> error "No tests found!?"
Just act -> ifM act
diff --git a/doc/bugs/git_annex_test_fails/comment_1_5e107e34b28a48c16d1240ea02d09439._comment b/doc/bugs/git_annex_test_fails/comment_1_5e107e34b28a48c16d1240ea02d09439._comment
new file mode 100644
index 000000000..c36a36041
--- /dev/null
+++ b/doc/bugs/git_annex_test_fails/comment_1_5e107e34b28a48c16d1240ea02d09439._comment
@@ -0,0 +1,20 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2017-09-29T18:26:39Z"
+ content="""
+[Two separate problems reported in one bug report always makes extra work and
+risks one of the probles being forgotten about.
+Separate bug reports for separate problems, please.]
+
+I can reproduce test not working outside of a git repository.
+That is a reversion from 6.20170818. Bisected to commit
+db2a06b66f0aaf5a8e8822a0c01aa614a8e7a5a9. Fixed.
+
+The too many open files was also mentioned by another OSX user (also in a
+bug report about something else; that bug was closed...). I have not quite
+reproduced it, but running git-annex test on OSX I did see it was using 600
+or more open files and had quite a few git processes stacked up. There may
+be a small leak there, that's more likely to trip over a smaller limit on
+OSX.
+"""]]