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

haskell generic-builder: Fix package conf handling #78738

Closed
wants to merge 5 commits into from

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Jan 29, 2020

Motivation for this change

Previously the package conf files were handled without paying attention to the fact that it's pretty-printed output. One problem was discovered with GHC 8.8.1 on Darwin, where the dynamic-library-dirs first field seems to have increased in length, meaning while before it was

dynamic-library-dirs: some-small-directory-name
                      some-more-directories

Now it is

dynamic-library-dirs:
    some-larger-directory-name
    some-more-directories

Which breaks the code installed for #25537 because it assumed the former format, resulting in the reoccurence of the bug in #22810, see infinisil/all-hies#43

This commit fixes this by unprettifying the package conf files before
processing them. This also gets rid of a nasty sed expression previously used to do this conf format juggling

The only change of behavior is that whereas previously above line would be changed to

dynamic-library-dirs: $out/lib/links
                      some-more-directories

it now is changed to (some-more-directories isn't present anymore)

dynamic-library-dirs: $out/lib/links

But this isn't a problem because all .dylib's in those directories will have been symlinked into $out/lib/links anyways.

Ping @peti @copumpkin @Ericson2314 @LnL7 @shlevy

Things done

peti and others added 4 commits January 25, 2020 02:30
This update was generated by hackage2nix v2.15.0-14-gb942b6a from Hackage revision
commercialhaskell/all-cabal-hashes@dd3690b.
ghc: update 8.10.1 pre-release to announced rc1
This update was generated by hackage2nix v2.15.0-14-gb942b6a from Hackage revision
commercialhaskell/all-cabal-hashes@31aa820.
@infinisil
Copy link
Member Author

Such that people can find this issue, here is the error message this fixes on macOS using GHC 8.8.1 (can occur during building or running):

dyld: Library not loaded: @rpath/libHShaskell-ide-engine-1.0.0.0-5EcNvjBz4sl3yA1Hn7NQQN-ghc8.8.1.dylib
  Referenced from: /Users/malo/.nix-profile/bin/hie-8.8.1
  Reason: no suitable image found.  Did find:
        /nix/store/gvdg0v5c0n8h0yi75w6k8gzn17wdr4q0-haskell-ide-engine-ghc881-970637fa13/lib/ghc-8.8.1/x86_64-osx-ghc-8.8.1/libHShaskell-ide-engine-1.0.0.0-5EcNvjBz4sl3yA1Hn7NQQN-ghc8.8.1.dylib: malformed mach-o: load commands size (33984) > 32768

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work munging around with the stuff. We should raise the issue upstream that they ought to migrate to more standardized encodings.

Previously the package conf files were handled without paying attention
to the fact that it's pretty-printed output. One problem was discovered
with GHC 8.8.1 on Darwin, where the dynamic-library-dirs first field
seems to have increased in length, meaning while before it was

    dynamic-library-dirs: some-small-directory-name
                          some-more-directories

Now it is

    dynamic-library-dirs:
        some-larger-directory-name
	some-more-directories

Which breaks the code installed for NixOS#25537,
because that assumed the former format, resulting in the reoccurence of
the bug in NixOS#22810, see
infinisil/all-hies#43

This commit fixes this by "unprettyfying" the package conf files before
processing them.
@infinisil
Copy link
Member Author

Oh and another change of behavior is how now all directories in dynamic-library-dirs are being checked for dynamic libraries instead of just the first one. Because of this I just had to push a fix for when such a directory is empty

@infinisil
Copy link
Member Author

With this change I just pushed I can confirm that this fixes the issue

@infinisil
Copy link
Member Author

Anybody have any objections? Otherwise I'd like to have this merged soon

peti pushed a commit that referenced this pull request Jan 31, 2020
Previously the package conf files were handled without paying attention
to the fact that it's pretty-printed output. One problem was discovered
with GHC 8.8.1 on Darwin, where the dynamic-library-dirs first field
seems to have increased in length, meaning while before it was

    dynamic-library-dirs: some-small-directory-name
                          some-more-directories

Now it is

    dynamic-library-dirs:
        some-larger-directory-name
        some-more-directories

Which breaks the code installed for #25537,
because that assumed the former format, resulting in the reoccurence of
the bug in #22810, see
infinisil/all-hies#43

This commit fixes this by "unprettyfying" the package conf files before
processing them.

Closes #78738.
@peti
Copy link
Member

peti commented Jan 31, 2020

Pushed in 55a8169. Test builds are running at https://hydra.nixos.org/eval/1567978.

@infinisil
Copy link
Member Author

Seems to be failing, but that very much seems unrelated:

make[1]: *** [compiler/ghc.mk:445: compiler/stage2/build/HsInstances.p_o] Segmentation fault (core dumped)

I hope that's just a transient failure, I'll restart the build

@infinisil
Copy link
Member Author

Nevermind, I can't restart that job, "Only the project members, administrators, and accounts with restart-jobs privileges can perform this operation."

@peti
Copy link
Member

peti commented Jan 31, 2020

I have restarted the ghc-8.8.1 build.

@peti peti closed this in 8d4509e Jan 31, 2020
@infinisil infinisil deleted the haskell-updates branch January 31, 2020 20:57
infinisil added a commit to infinisil/all-hies that referenced this pull request Feb 1, 2020
anna328p pushed a commit to anna328p/nixpkgs that referenced this pull request Feb 2, 2020
Previously the package conf files were handled without paying attention
to the fact that it's pretty-printed output. One problem was discovered
with GHC 8.8.1 on Darwin, where the dynamic-library-dirs first field
seems to have increased in length, meaning while before it was

    dynamic-library-dirs: some-small-directory-name
                          some-more-directories

Now it is

    dynamic-library-dirs:
        some-larger-directory-name
        some-more-directories

Which breaks the code installed for NixOS#25537,
because that assumed the former format, resulting in the reoccurence of
the bug in NixOS#22810, see
infinisil/all-hies#43

This commit fixes this by "unprettyfying" the package conf files before
processing them.

Closes NixOS#78738.
jpgu-epam pushed a commit to jpgu-epam/nixpkgs that referenced this pull request Feb 4, 2020
Previously the package conf files were handled without paying attention
to the fact that it's pretty-printed output. One problem was discovered
with GHC 8.8.1 on Darwin, where the dynamic-library-dirs first field
seems to have increased in length, meaning while before it was

    dynamic-library-dirs: some-small-directory-name
                          some-more-directories

Now it is

    dynamic-library-dirs:
        some-larger-directory-name
        some-more-directories

Which breaks the code installed for NixOS#25537,
because that assumed the former format, resulting in the reoccurence of
the bug in NixOS#22810, see
infinisil/all-hies#43

This commit fixes this by "unprettyfying" the package conf files before
processing them.

Closes NixOS#78738.
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.

None yet

4 participants