From: sven.panne@aedion.de Date: Sun, 2 Sep 2007 12:55:21 +0000 (+0000) Subject: Fixed permission setting in copyFile X-Git-Tag: 2007-09-13^0 X-Git-Url: http://git.megacz.com/?p=haskell-directory.git;a=commitdiff_plain;h=fe5420ba0484d7a0937ec3a1153bd9b41967a803;hp=ce0ccf7e2f726cfcf3fb4648408b142265c41460 Fixed permission setting in copyFile Copy the permissions to the *temporary* file before moving it, no to the probably non-existing real destination file. Before this fix, "try" silently wiped this bug under the carpet, leading to silently broken permissions. --- diff --git a/System/Directory.hs b/System/Directory.hs index e7affb6..c3698a2 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -553,7 +553,7 @@ copyFile fromFPath toFPath = bracketOnError openTmp cleanTmp $ \(tmpFPath, hTmp) -> do allocaBytes bufferSize $ copyContents hFrom hTmp hClose hTmp - try (copyPermissions fromFPath toFPath) + try (copyPermissions fromFPath tmpFPath) renameFile tmpFPath toFPath openTmp = openBinaryTempFile (takeDirectory toFPath) ".copyFile.tmp" cleanTmp (tmpFPath, hTmp) = do try $ hClose hTmp