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

cabal.project: Add a constraint on unix. #3942

Merged
merged 1 commit into from
Oct 6, 2016
Merged

Conversation

23Skidoo
Copy link
Member

@23Skidoo 23Skidoo commented Oct 5, 2016

Fixes #3938.

@mention-bot
Copy link

@23Skidoo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts and @hvr to be potential reviewers.

@ezyang
Copy link
Contributor

ezyang commented Oct 5, 2016

OK, but why not also put the constraint in cabal-install.cabal?

@23Skidoo
Copy link
Member Author

23Skidoo commented Oct 5, 2016

If I understand #2653 correctly, the constraint should be in Cabal.cabal. This will make Cabal non-buildable out of the box on GHC 7.8.

@23Skidoo
Copy link
Member Author

23Skidoo commented Oct 5, 2016

...and now it fails on all GHCs <= 7.8:

$ /home/travis/build/haskell/cabal/dist-newstyle/build/Cabal-1.25.0.0/build/package-tests/package-tests
(Re)configuring test suite (ignoring LBI)
Cabal test suite - testing cabal version 1.25.0.0
Cabal build directory: /home/travis/build/haskell/cabal/dist-newstyle/build/Cabal-1.25.0.0
Cabal source directory: /home/travis/build/haskell/cabal/Cabal
File modtime calibration: 20.0 (maximum observed: 4.425)
Environment:
CABAL_PACKAGETESTS_GHC="/opt/ghc/7.8.4/bin/ghc" \
CABAL_PACKAGETESTS_GHC_PKG="/opt/ghc/7.8.4/bin/ghc-pkg" \
CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.8.4/bin/ghc" \
CABAL_PACKAGETESTS_WITH_GHC_PKG="/opt/ghc/7.8.4/bin/ghc-pkg" \
CABAL_PACKAGETESTS_DB_STACK="clear:global:user"
CABAL_PACKAGETESTS_WITH_DB_STACK="clear:global:user"
Building shared ./Setup executable
package-tests: could not build shared Setup executable
  ran: /opt/ghc/7.8.4/bin/ghc-7.8.4 --make -clear-package-db -global-package-db -user-package-db '-package-db=/home/travis/build/haskell/cabal/dist-newstyle/build/Cabal-1.25.0.0/package.conf.inplace' '-hide-package Cabal' '-package Cabal-1.25.0.0' -O0 Setup.hs
  output:
<command line>: cannot satisfy -package Cabal-1.25.0.0
    (use -v for more information)

Looks related to this fragment in PackageTester.hs:

    r <- rawRun verbosity (Just path) (ghcPath suite) e $
        [ "--make"] ++
        ghcPackageDBParams (ghcVersion suite) (packageDBStack suite) ++
        [ "-hide-package Cabal"
        -- This mostly works, UNLESS you've installed a
        -- version of Cabal with the SAME version number.
        -- Then old GHCs will incorrectly select the installed
        -- version (because it prefers the FIRST package it finds.)
        -- It also semi-works to not specify "-hide-all-packages"
        -- at all, except if there's a later version of Cabal
        -- installed GHC will prefer that.
        , "-package Cabal-" ++ display cabalVersion
        , "-O0"
        , "Setup.hs" ]

@ezyang, you wrote that code, any ideas? The -hide-package Cabal -package Cabal-1.25.0.0 bit looks suspicious.

@ezyang
Copy link
Contributor

ezyang commented Oct 5, 2016

Actually, the problem is obvious: for some reason, the Setup build isn't using the Nix-local build store, so the Cabal library is broken because it can't find the newer Unix. Fix coming.

@ezyang
Copy link
Contributor

ezyang commented Oct 6, 2016

Ah, this is annoying. Some of the cabal-install tests use the built-in Cabal library to test Custom scripts, and those are obviously going to fail. Ugh.

On recent OS X, Cabal does not work correctly because it assumes
that a permission denied error when reading permissions on
executables, resulting in errors like "Setup: /usr/bin/ar: permission denied".

The proximal fix for this is to add a constraint on unix when we build
Cabal/cabal-install to avoid building with the buggy version of unix.
But this causes other problems:

- Bumping the version of unix means that our local build of Cabal
  will depend on things from the store.  But we weren't passing
  this to GHC when compiled Setup.hs for Cabal's package-tests.
  Set CABAL_PACKAGETESTS_DB_STACK env var explicitly to point
  to the right locations.

- The new configuration of versions exposed some bugs in some
  macro expanded code in cabal-install; we qualified those
  imports to squash unused warnings.

- The cabal-install integration-tests occasionally use Cabal from
  the system GHC.  Since this will never work on OS X, we just
  skip the tests in those cases.

Signed-off-by: Edward Z. Yang <[email protected]>
@ezyang
Copy link
Contributor

ezyang commented Oct 6, 2016

I think the newest version of the patch I've pushed here should green CI. When it finishes testing I'll merge.

@ezyang ezyang merged commit ff08346 into haskell:master Oct 6, 2016
@23Skidoo 23Skidoo deleted the issue-3938 branch October 6, 2016 07:55
@23Skidoo
Copy link
Member Author

23Skidoo commented Oct 6, 2016

@ezyang Awesome, thanks!

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.

3 participants