Patch that fixes the long standing sdist file permission bug

Duncan Coutts duncan.coutts at googlemail.com
Mon Jan 17 15:58:04 CET 2011


On 16 January 2011 23:30, John D. Ramsdell <ramsdell at mitre.org> wrote:
> Duncan Coutts <duncan.coutts at googlemail.com> writes:
>
>> On Mon, 2010-12-20 at 13:27 -0500, John D. Ramsdell wrote:
>>> Mon Dec 20 13:13:08 EST 2010  ramsdell at mitre.org
>>>   * sdist perms fix
>>
>> Thanks for that John. Applied.
>
> Thank you.  Do you want me to provide you with a list of bug reports
> that the patch resolves?  I think the bug was reported three times.

Oh thanks for reminding me :-)

http://hackage.haskell.org/trac/hackage/ticket/627
http://hackage.haskell.org/trac/hackage/ticket/752
http://hackage.haskell.org/trac/hackage/ticket/772

Any others?

Actually, looking at these tickets, I don't think we have fixed all
the problems.

Previously we were using copyFile to create files in the tarball image
dir, now were are using copyOrdinaryFile. The former creates target
files with default permissions. The latter creates files with
-rw-r--r-- permissions.

So this only fixes the problem listed in ticket #627 that "Every file
has mode 0600". We still have not fixed the problem that files with
executable permissions are not preserved.

What I've done is:
    +           -- preserve executable bit on extra-src-files like ./configure
    +           perms <- getPermissions file
    +           when (executable perms) --only checks user x bit
    +                (setFileExecutable (targetDir </> file))

So instead of preserving all permissions, we just check if it's
executable and if so set standard executable perms. I think this makes
sense given the use case of making a tarball, where only a few
standard set of permissions make sense.

Ticket #627 also mentions that we do not preserve permissions on cabal
unpack, so I've fixed that too.

So I think it's all fixed now.

Duncan



More information about the cabal-devel mailing list