res <- withTmpWorkDir key $ \workdir ->
youtubeDl url (fromRawFilePath workdir) p >>= \case
Right (Just mediafile) -> do
- liftIO $ renameFile mediafile dest
+ liftIO $ moveFile (toRawFilePath mediafile) (toRawFilePath dest)
return (Just True)
Right Nothing -> return (Just False)
Left msg -> do
* Change --metadata comparisons < > <= and >= to fall back to
lexicographical comparisons when one or both values being compared
are not numbers.
+ * Improve handling of some .git/annex/ subdirectories being on other
+ filesystems, in the bittorrent special remote, and youtube-dl
+ integration, and git-annex addurl.
-- Joey Hess <id@joeyh.name> Mon, 12 Dec 2022 13:04:54 -0400
-- Move to final location for large file check.
pruneTmpWorkDirBefore tmp $ \_ -> do
createWorkTreeDirectory (P.takeDirectory file)
- liftIO $ renameFile
- (fromRawFilePath tmp)
- (fromRawFilePath file)
+ liftIO $ moveFile tmp file
largematcher <- largeFilesMatcher
large <- checkFileMatcher largematcher file
if large
-- Move back to tmp because addAnnexedFile
-- needs the file in a different location
-- than the work tree file.
- liftIO $ renameFile
- (fromRawFilePath file)
- (fromRawFilePath tmp)
+ liftIO $ moveFile file tmp
go
else Command.Add.addSmall (DryRun False) file s
>>= maybe noop void
ok <- Url.withUrlOptions $
Url.download nullMeterUpdate Nothing u f
when ok $
- liftIO $ renameFile f (fromRawFilePath torrent)
+ liftIO $ moveFile (toRawFilePath f) torrent
return ok
)
<$> dirContents metadir
case ts of
(t:[]) -> do
- renameFile t dest
+ moveFile (toRawFilePath t) (toRawFilePath dest)
return True
_ -> return False
, return False
showOutput
ifM (download torrent downloaddir <&&> liftIO (doesFileExist dlf))
( do
- liftIO $ renameFile dlf dest
+ liftIO $ moveFile (toRawFilePath dlf) (toRawFilePath dest)
-- The downloaddir is not removed here,
-- so if aria downloaded parts of other
-- files, and this is called again, it will
This is a temp directory for miscellaneous other temp files.
-While .git/annex/objects and .git/annex/tmp can be put on different
-filesystems if desired, .git/annex/othertmp
-has to be on the same filesystem as the work tree and git repository.
-
### `.git/annex/bad/`
git-annex fsck puts any bad objects it finds in here.
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""re: why othertmp to be on the same file system?"""
+ date="2022-12-20T18:39:35Z"
+ content="""
+I've audited the code and the only place I could find where it did not work
+to have othertmp on a different filesystem is in the bittorrent special
+remote when it downloads a torrent file. But that also failed when
+`.git/annex/tmp` was on a different filesystem! (Since it was moving between
+the two directories.) I've fixed that.
+
+It's still best to keep things on the same filesystem because
+cross-filesystem moves can be expensive and it sometimes falls back to less
+ideal behavior in other ways too when operating across filesystems. Also
+of course, you avoid being the one who gets to find and report breakage
+like the above..
+"""]]