summaryrefslogtreecommitdiff
path: root/doc/bugs/Disconcerting_warning_from_git-annex/comment_3_13999207f4ddac2f9c345415f25f7ada._comment
blob: 142e6ecd117d381bc71a111c94509c0611d1f724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[[!comment format=mdwn
 username="http://joeyh.name/"
 ip="209.250.56.102"
 subject="moreinfo"
 date="2014-03-19T20:49:47Z"
 content="""
What I don't understand about this is, how does `open` fail due to a file being locked? This is Linux, it doesn't have mandatory locking that I know of, and git-annex certianly doesn't use such a thing.

I really need a way to reproduce this and/or a strace. As it is, I've never seen this reported by anyone else and don't understand the failure mode at all.

The relevant part of the code seems to be here:

[[!format haskell \"\"\"
setJournalFile :: JournalLocked -> FilePath -> String -> Annex ()
setJournalFile _jl file content = do
        tmp <- fromRepo gitAnnexTmpMiscDir
        createAnnexDirectory =<< fromRepo gitAnnexJournalDir
        createAnnexDirectory tmp
        -- journal file is written atomically
        jfile <- fromRepo $ journalFile file
        let tmpfile = tmp </> takeFileName jfile
        liftIO $ do
                writeBinaryFile tmpfile content
                moveFile tmpfile jfile
\"\"\"]]

While there is some ctnl locking going on, it locks a special sentinal file, not the file it's writing to.
"""]]