From 6e71094e7d44a2104d05dd175b2ca6e090043f58 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Dec 2015 16:42:40 -0400 Subject: [PATCH] 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(-) 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 -- 2.30.2