From a279c22dbcddee19d14a1b492d8d996fef0e3e3d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Dec 2015 16:42:40 -0400 Subject: 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. --- Annex/ReplaceFile.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Annex') diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs index b090da905..b6126ba7e 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 -- cgit v1.2.3