File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,20 @@ streamStringOutIO f executable getChunk =
123123 " Failed to stream string to " <> f <> " : " <> show e
124124
125125-- | Check whether the file is executable by the owner.
126+ --
127+ -- Matches the logic used by Nix.
128+ --
129+ -- access() should not be used for this purpose on macOS.
130+ -- It returns false for executables when placed in certain directories.
131+ -- For example, when in an app bundle: App.app/Contents/Resources/en.lproj/myexecutable.strings
126132isExecutable :: FileStatus -> Bool
127133isExecutable st =
128134 isRegularFile st
129135 && fileMode st `intersectFileModes` ownerExecuteMode /= nullFileMode
130136
131137-- | Set the file to be executable by the owner, group, and others.
138+ --
139+ -- Matches the logic used by Nix.
132140setExecutable :: FilePath -> IO ()
133141setExecutable f = do
134142 st <- getSymbolicLinkStatus f
Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ unit_nixStoreDirectory' :: HU.Assertion
145145unit_nixStoreDirectory' = filesystemNixStore " directory'" (Nar sampleDirectory')
146146
147147-- | Test that the executable permissions are handled correctly in app bundles on macOS.
148+ -- In this case, access() returns false for a file under this specific path, even when the executable bit is set.
149+ -- NAR implementations should avoid this syscall on macOS.
148150test_nixStoreMacOSAppBundle :: TestTree
149151test_nixStoreMacOSAppBundle = packThenExtract " App.app" $ \ baseDir -> do
150152 let testDir = baseDir </> " App.app" </> " Resources" </> " en.lproj"
You can’t perform that action at this time.
0 commit comments