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

Make scrypt test dep optional and not required on darwin #85

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

cdepillabout
Copy link
Owner

@cdepillabout cdepillabout commented Nov 8, 2024

This is a slight improvement on #84.

I've also confirmed that stack test --flag password:-scrypt password builds without problems (on Linux at least).

See the following for more information:

password/password.cabal Outdated Show resolved Hide resolved
@@ -30,9 +31,7 @@ testScrypt = testGroup "scrypt"
checkPassword
extractParams
testsParams8Rounds
#ifndef IS_MAC_OS
, testProperty "scrypt <-> cryptonite" $ withMaxSuccess 10 checkScrypt
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't feel like acting we're testing something when we're not is a good idea.

I'd prefer:

#ifndef darwin_HOST_OS
    , testProperty "scrypt <-> cryptonite" $ withMaxSuccess 10 checkScrypt
#endif

And just not defining checkScrypt.

Copy link
Owner Author

Choose a reason for hiding this comment

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

That's a good point. I've changed this back in b5a96ef.


-- The scrypt package is optionally used in tests to ensure compatibility
-- between password and scrypt. However, scrypt doesn't work on OSX, so
-- we only add the scrypt dependency if we're not building on OSX.

Choose a reason for hiding this comment

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

That's not enough. scrypt requires x86_64 with SSE2 instruction set, so also aarch64-linux etc. aren't available.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So we should be using x86_64_HOST_ARCH?

Is that also the reason it doesn't work on OSX? Or can darwin also be x86_64 sometimes? 🤔

Copy link

@sternenseemann sternenseemann Nov 8, 2024

Choose a reason for hiding this comment

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

Yes. x86_64-darwin works fine (with a new enough CPU). aarch64-darwin is broken.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah, thanks for the clarification here, I've updated the tests to only run on x86_64 in b5a96ef.

`password` contains a test that the Scrypt support in `password` is
compatible with the actual `scrypt` Haskell package.

However, the `scrypt` Haskell package only runs on x86_64 (with the SSE2
instruction set).

This commit updates the Scrypt compatibility tests in `password` to only
be included if we're building on x86_64.

See
#85 (review)
for more information.
@Vlix Vlix self-requested a review November 9, 2024 14:24
@Vlix
Copy link
Collaborator

Vlix commented Nov 9, 2024

Looks good 👍

You could also include a version bump + Changelog addition. (-> 3.1.0.1?)

@cdepillabout cdepillabout merged commit a37127d into master Nov 10, 2024
16 checks passed
@cdepillabout cdepillabout deleted the optional-scrypt-lib branch November 10, 2024 08:16
@cdepillabout
Copy link
Owner Author

Thanks! I've tagged and released as https://hackage.haskell.org/package/password-3.1.0.1

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