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
merged 1 commit into from Jul 23, 2015

Conversation

Projects
None yet
2 participants
@Fuuzetsu
Contributor

Fuuzetsu commented Jul 23, 2015

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

Preserve file permissions when unpacking sources
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

This comment has been minimized.

Contributor

snoyberg commented Jul 23, 2015

Testing on Windows before merging, but this looks good.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jul 23, 2015

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

This comment has been minimized.

Contributor

Fuuzetsu commented Jul 23, 2015

@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

This comment has been minimized.

Contributor

snoyberg commented Jul 23, 2015

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

snoyberg added a commit that referenced this pull request Jul 23, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jul 23, 2015

Fix added for Windows and merged, thanks!

snoyberg added a commit that referenced this pull request Jul 23, 2015

@Fuuzetsu Fuuzetsu deleted the Fuuzetsu:fix-tar-unpack-permissions branch Jul 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment