Skip to content

Commit

Permalink
Fix v2-sdist permissions
Browse files Browse the repository at this point in the history
Fixes #5813.
  • Loading branch information
typedrat authored and phadej committed Apr 7, 2020
1 parent 95a6ee3 commit 4428699
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cabal-install/Distribution/Client/CmdSdist.hs
Expand Up @@ -75,7 +75,8 @@ import Data.List
import qualified Data.Set as Set
import System.Directory
( getCurrentDirectory, setCurrentDirectory
, createDirectoryIfMissing, makeAbsolute )
, createDirectoryIfMissing, makeAbsolute
, getPermissions, executable )
import System.FilePath
( (</>), (<.>), makeRelative, normalise, takeDirectory )

Expand Down Expand Up @@ -281,10 +282,11 @@ packageToSdist verbosity projectRootDir format outputFile pkg = do
Right path -> tell [Tar.directoryEntry path]

for_ files $ \(perm, file) -> do
realPerm <- getPermissions file
let fileDir = takeDirectory (prefix </> file)
perm' = case perm of
Exec -> Tar.executableFilePermissions
NoExec -> Tar.ordinaryFilePermissions
Exec | executable realPerm -> Tar.executableFilePermissions
_ -> Tar.ordinaryFilePermissions
needsEntry <- gets (Set.notMember fileDir)

when needsEntry $ do
Expand Down

0 comments on commit 4428699

Please sign in to comment.