-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix v2-sdist
permissions
#6454
Fix v2-sdist
permissions
#6454
Conversation
let fileDir = takeDirectory (prefix </> file) | ||
perm' = case perm of | ||
Exec -> Tar.executableFilePermissions | ||
NoExec -> Tar.ordinaryFilePermissions | ||
Exec | executable realPerm -> Tar.executableFilePermissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems rather odd that we can have files marked as Exec
that don't have executable permissions. Would it not be cleaner to change the implementation of listPackageSources
so that these files are marked as NoExec
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On reflection, that's weird. I think, instead of surgically fixing this issue, it might be worth considering a more thorough change to properly read the permissions and set it based on that, and not bother using the cruddy heuristic that we currently have at all, unless there's an important reason I'm not remembering for why we want to ignore some files' permissions.
This does have the downside that changing permissions (and not file contents) will now be able to invalidate package hashes, which I think is the original reason I had it not check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The culrpit looks to be in SrcDist.hs
-- | List those source files that may be executable (e.g. the configure script).
listPackageSourcesMaybeExecutable :: Verbosity -> PackageDescription -> IO [FilePath]
listPackageSourcesMaybeExecutable verbosity pkg_descr =
-- Extra source files.
fmap concat . for (extraSrcFiles pkg_descr) $ \fpath ->
matchDirFileGlob verbosity (specVersion pkg_descr) "." fpath
i.e. every extraSrcFiles
are given executable bits now? e.g. for lens-4.18.1.tar.gz
from Hackage:
% tar -tzvf lens-4.18.1.tar.gz|grep README
-rwxr-xr-x 0/0 7427 2001-09-09 04:46 lens-4.18.1/README.markdown
IMHO that's just plain wrong.
What would break if all files are 644
(and directories 755)?
For example, configure
script is actually run by invoking sh
on it, see runConfigureScript
shConfiguredProg <- lookupProgram shProg
`fmap` configureProgram verbosity shProg progDb
case shConfiguredProg of
Just sh -> runProgramInvocation verbosity $
(programInvocation (sh {programOverrideEnv = overEnv}) args')
{ progInvokeCwd = Just (buildDir lbi) }
Nothing -> die' verbosity notFoundMsg
(and #5813 (comment) suggest that if we unpack without executable bits, why store them in the first place).
I would be worried of invalidating cache. It's cache for a reason.
merged as part of #6666 |
Fixes #5813.
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!