Fix chmod on executables, wrt #97

This commit is contained in:
Julian Ospald 2020-12-20 01:27:27 +08:00
parent e8361c564a
commit b0f90c096f
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 12 additions and 9 deletions

View File

@ -333,7 +333,7 @@ installCabalBindist dlinfo ver (PlatformRequest {..}) = do
(path </> cabalFile)
(destPath)
Overwrite
lift $ chmod_777 destPath
lift $ chmod_755 destPath
-- | Installs cabal into @~\/.ghcup\/bin/cabal-\<ver\>@ and
@ -449,7 +449,7 @@ installHLSBindist dlinfo ver (PlatformRequest {..}) = do
(path </> f)
(inst </> toF)
Overwrite
lift $ chmod_777 (inst </> toF)
lift $ chmod_755 (inst </> toF)
-- install haskell-language-server-wrapper
let wrapper = [rel|haskell-language-server-wrapper|]
@ -458,7 +458,7 @@ installHLSBindist dlinfo ver (PlatformRequest {..}) = do
(path </> wrapper)
(inst </> toF)
Overwrite
lift $ chmod_777 (inst </> toF)
lift $ chmod_755 (inst </> toF)
-- | Installs hls binaries @haskell-language-server-\<ghcver\>@
@ -1319,7 +1319,7 @@ upgradeGHCup dls mtarget force pfreq = do
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
fullDest
Overwrite
lift $ chmod_777 fullDest
lift $ chmod_755 fullDest
pure latestVer

View File

@ -440,13 +440,16 @@ isBrokenSymlink p =
pure False
chmod_777 :: (MonadLogger m, MonadIO m) => Path a -> m ()
chmod_777 (toFilePath -> fp) = do
chmod_755 :: (MonadLogger m, MonadIO m) => Path a -> m ()
chmod_755 (toFilePath -> fp) = do
let exe_mode =
newFilePerms
nullFileMode
`unionFileModes` ownerExecuteMode
`unionFileModes` ownerReadMode
`unionFileModes` ownerWriteMode
`unionFileModes` groupExecuteMode
`unionFileModes` groupReadMode
`unionFileModes` otherExecuteMode
$(logDebug) [i|chmod 777 #{fp}|]
`unionFileModes` otherReadMode
$(logDebug) [i|chmod 755 #{fp}|]
liftIO $ setFileMode fp exe_mode