avoid rsync failing with a permissions error
The test suite was intermittently failing with rsync complaining it could not write to dest. get foo (from origin...) SHA256E-s20--e394a389d787383843decc5d3d99b6d184ffa5fddeec23b911f9ee7fc8b9ea77 20 100% 0.00kB/s 0:00:00 ^M 20 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1) (from origin...) SHA256E-s20--e394a389d787383843decc5d3d99b6d184ffa5fddeec23b911f9ee7fc8b9ea77 20 100% 0.00kB/s 0:00:00 ^M 20 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1) rsync: open "/home/joey/src/git-annex/.t/tmprepo1103/.git/annex/tmp/SHA256E-s20--e394a389d787383843decc5d3d99b6d184ffa5fddeec23b911f9ee7fc8b9ea77" failed: Permission denied (13) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3] It seems that the first rsync actually transferred the file, but then for some reason git-annex thinks it failed, so it retries. The second rsync then fails because the first rsync copied the file mode over and so the file is not writable now. So, this fixes that problem, but leaves open the question of why git-annex would think rsync failed when it wrote the file and didn't output any error message. Possibly a bug in rsyncProgress that either hides an error message, or somehow makes rsync unhappy?
This commit is contained in:
parent
5798d063b0
commit
f27c5db5c5
1 changed files with 3 additions and 0 deletions
|
@ -43,6 +43,7 @@ import qualified CmdLine.GitAnnexShell.Fields as Fields
|
|||
import Logs.Location
|
||||
import Utility.Metered
|
||||
import Utility.CopyFile
|
||||
import Utility.FileMode
|
||||
import Utility.Env
|
||||
import Utility.Batch
|
||||
import Utility.SimpleProtocol
|
||||
|
@ -741,6 +742,8 @@ rsyncOrCopyFile st rsyncparams src dest p =
|
|||
copycowtried = case st of
|
||||
State _ _ (CopyCoWTried v) _ -> v
|
||||
dorsync = do
|
||||
-- dest may already exist, so make sure rsync can write to it
|
||||
void $ liftIO $ tryIO $ allowWrite dest
|
||||
oh <- mkOutputHandler
|
||||
Ssh.rsyncHelper oh (Just p) $
|
||||
rsyncparams ++ [File src, File dest]
|
||||
|
|
Loading…
Reference in a new issue