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.
This commit is contained in:
parent
9b94454b25
commit
f84e34883c
4 changed files with 43 additions and 22 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
2
Test.hs
2
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
|
||||
|
|
|
@ -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.
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue