From: Joey Hess Date: Sun, 6 Dec 2015 20:42:40 +0000 (-0400) Subject: avoid too long temp dir template X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~322^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6e71094e7d44a2104d05dd175b2ca6e090043f58;p=git-annex.git avoid too long temp dir template The filename might be at or close to the filename length limit, so using it as the template for the temp dir would then fail. --- diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs index b090da9057..b6126ba7ee 100644 --- a/Annex/ReplaceFile.hs +++ b/Annex/ReplaceFile.hs @@ -27,7 +27,8 @@ replaceFile :: FilePath -> (FilePath -> Annex ()) -> Annex () replaceFile file action = do misctmpdir <- fromRepo gitAnnexTmpMiscDir void $ createAnnexDirectory misctmpdir - let basetmp = takeFileName file + filemax <- liftIO $ fileNameLengthLimit misctmpdir + let basetmp = take (filemax `div` 2) (takeFileName file) withTmpDirIn misctmpdir basetmp $ \tmpdir -> do let tmpfile = tmpdir <> basetmp action tmpfile