Skip to content
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

Preserve file permissions when unpacking sources #666

Merged

Conversation

Fuuzetsu
Copy link
Contributor

The tar package, in name of portability, doesn't preserve file
permissions when creating and unpacking archives. A sample package which
relies on permissions to be kept as they were packed with is
ghc-parser which executes a bash script as part of its build process.

Before this patch we'd get

    /run/user/1000/stack26234/ghc-parser-0.1.7.0/Setup.hs:2:1: Warning:
        Module ‘System.Cmd’ is deprecated: Use "System.Process" instead
    /bin/sh: ./build-parser.sh: Permission denied
    Configuring ghc-parser-0.1.7.0...
    Warning: 'hs-source-dirs: src-7.8.3' directory does not exist.

but now the package builds fine.

cc @mboes

The `tar` package, in name of portability, doesn't preserve file
permissions when creating and unpacking archives. A sample package which
relies on permissions to be kept as they were packed with is
`ghc-parser` which executes a bash script as part of its build process.

Before this patch we'd get

```
    /run/user/1000/stack26234/ghc-parser-0.1.7.0/Setup.hs:2:1: Warning:
        Module ‘System.Cmd’ is deprecated: Use "System.Process" instead
    /bin/sh: ./build-parser.sh: Permission denied
    Configuring ghc-parser-0.1.7.0...
    Warning: 'hs-source-dirs: src-7.8.3' directory does not exist.
```

but now the package builds fine.
@snoyberg snoyberg self-assigned this Jul 23, 2015
@snoyberg
Copy link
Contributor

Testing on Windows before merging, but this looks good.

@snoyberg
Copy link
Contributor

Hmm, I'm getting errors like this when running the integration test on Windows:

setPermissions: does not exist (No such file or directory)

Do you have access to a Windows system to test this on?

@Fuuzetsu
Copy link
Contributor Author

@snoyberg No Windows machine access. I'm not sure why that problem would occur: FP.</> uses native separator, and fromTarPath (https://hackage.haskell.org/package/tar-0.4.2.0/docs/Codec-Archive-Tar-Entry.html#v:fromTarPath) is documented to convert to native separator. Simple way to check would be to print the path we get but as I said, I don't have access to a Windows machine. I'd be leaning towards fromTarPath not doing its job properly but can't check.

@snoyberg
Copy link
Contributor

It seems like Windows doesn't like setting permissions on a directory when a trailing backslash is present. I think I can fix this easily.

@snoyberg snoyberg merged commit ca99db4 into commercialhaskell:master Jul 23, 2015
@snoyberg
Copy link
Contributor

Fix added for Windows and merged, thanks!

snoyberg added a commit that referenced this pull request Jul 23, 2015
@Fuuzetsu Fuuzetsu deleted the fix-tar-unpack-permissions branch July 23, 2015 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants