fix reversion in recent CoW changes

File handle accidentially left open is both a FD leak and causes the
haskell RTS to reject opening it again with "file is locked".
This commit is contained in:
Joey Hess 2021-04-20 11:41:43 -04:00
parent 3d9d1d1416
commit fee6504388
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 28 additions and 1 deletions

View file

@ -494,7 +494,8 @@ retrieveExportWithContentIdentifierM dir cow loc cid dest mkkey p =
storeExportWithContentIdentifierM :: RawFilePath -> CopyCoWTried -> FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex ContentIdentifier storeExportWithContentIdentifierM :: RawFilePath -> CopyCoWTried -> FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex ContentIdentifier
storeExportWithContentIdentifierM dir cow src k loc overwritablecids p = do storeExportWithContentIdentifierM dir cow src k loc overwritablecids p = do
liftIO $ createDirectoryUnder dir (toRawFilePath destdir) liftIO $ createDirectoryUnder dir (toRawFilePath destdir)
withTmpFileIn destdir template $ \tmpf _tmph -> do withTmpFileIn destdir template $ \tmpf tmph -> do
liftIO $ hClose tmph
fileCopierUnVerified cow src tmpf k p fileCopierUnVerified cow src tmpf k p
let tmpf' = toRawFilePath tmpf let tmpf' = toRawFilePath tmpf
resetAnnexFilePerm tmpf' resetAnnexFilePerm tmpf'

View file

@ -23,3 +23,5 @@ looked only at "normal" run
so actually looks like the same test in various scenarios. so actually looks like the same test in various scenarios.
probably relates to the tune ups to make importtree work with CoW probably relates to the tune ups to make importtree work with CoW
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,7 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2021-04-20T15:10:59Z"
content="""
Indeed it was, file handle left open. Fixed.
"""]]

View file

@ -0,0 +1,17 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2021-04-20T15:10:00Z"
content="""
It's possible it had the same cause as the other failure, which I've now
fixed. That involved a file handle leak, and on windows a file handle being
left open for write is treated the same as the file being locked and will
prevent a later deletion attempt and also a later write attempt, which
could explain the two unlike failures.
However, the file that was left open was a temp file in the remote,
not the object file in the annex. So I'm not sure if it's fixed.
Also possible something else in the windows code path changed accidentially
during those CoW changes. Will have to see what happens when the
autobuilder runs again.
"""]]