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

Handle multivalued target_family #1320

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Jun 28, 2024

target_family / CARGO_CFG_TARGET_FAMILY is documented to be multi-valued.

This was found by a crater run in rust-lang/rust#124355 (comment). The concrete-csprng crate may fail to compile in the future if Rust decides to add further target families.

The commit history since v0.4.0 shows only cosmetic changes, so I've bumped the version to v0.4.1 to make it easier for you to release this as a patch version.

Check-list:

  • Tests for the changes have been added (for bug fixes / features)
    • Can't really test this yet, it's more of making sure that this works in the future.
  • Docs have been added / updated (for bug fixes / features)
  • Relevant issues are marked as resolved/closed, related issues are linked in the description
  • Check for breaking changes (including serialization changes) and add them to commit message following the conventional commit specification

Copy link

cla-bot bot commented Jun 28, 2024

Thank you for your pull request. We require contributors to sign our Contributor License Agreement / Terms and Conditions, and we don't seem to have the users @madsmtm on file. In order for us to review and merge your code, please sign:

  • For individual contribution: our CLA
  • for Bounty submission, if you are an individual: our T&C
  • for Bounty submission, if you are a company: our T&C
    to get yourself added.

If you already signed one of this document, just wait to be added to the bot config.

@IceTDrinker
Copy link
Member

Hello, thanks a lot for the report of the crater run, as you can see there is a CLA for outside contributors, in any case we’ll look to get this fixed as I believe the current use of the build.rs is an antipattern in concrete-csprng

@madsmtm
Copy link
Contributor Author

madsmtm commented Jun 28, 2024

I've signed the CLA, but not sure if that's enough. I don't care about attribution or anything for this PR, feel free to license these changes under whatever license you prefer, now or in the future. And you may freely rebase my name away from appearing in any commits if that's easier for your automated systems.

@IceTDrinker
Copy link
Member

@madsmtm let us know if you are willing to sign the CLA or if we should fix this ourselves given your report

@IceTDrinker
Copy link
Member

Ah let me check on our end then !

@aquint-zama
Copy link
Contributor

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Jun 28, 2024
Copy link

cla-bot bot commented Jun 28, 2024

The cla-bot has been summoned, and re-checked this pull request!

@IceTDrinker
Copy link
Member

@madsmtm thanks a lot for fixing this, very much appreciated 🙏

I see there is a formatting issue, could you run make fmt and push the corrected commit here amending the first one ?

one note however reading the docs on the topic really does not make it clear (in my opinion) that it can be multi valued, and no such multi valued example is provided (I'm guessing because it can't happen today).

Perhaps a "in the future CARGO_CFG_TARGET_FAMILY may contain several target families in a comma separated list e.g. CARGO_CFG_TARGET_FAMILY=unix,some_other_family and build.rs scripts are expected to properly parse those" or having a sort of build utils available from cargo that parses those env variables automatically and that can be loaded by the person writing the build.rs script would be useful as the proper behavior would always be enforced (or at least more easily enforced if build.rs writers just use the provided utils).

Let me know if there is a location where we can give this feedback to perhaps update some documentation

Cheers

@IceTDrinker IceTDrinker self-requested a review June 28, 2024 08:09
Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

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

Small logic bug in the any closure should be a != I believe

@IceTDrinker
Copy link
Member

if you prefer we do the fix to avoid back and forth @madsmtm let us know, we'll add a co-authored tag on the commit as you were the one to bring this to our attention, proper attribution is the least we can do !

@IceTDrinker IceTDrinker merged commit 1e0ed88 into zama-ai:main Jun 28, 2024
14 of 29 checks passed
@madsmtm madsmtm deleted the multivalued-target_family branch June 28, 2024 16:10
@madsmtm
Copy link
Contributor Author

madsmtm commented Jun 28, 2024

I see there is a formatting issue

Ah, sorry about this, I was somewhat lazy, and did this PR without fully setting up my editor :/. Have fixed it now, and actually tested that it works.

one note however reading the docs on the topic really does not make it clear (in my opinion) that it can be multi valued, and no such multi valued example is provided (I'm guessing because it can't happen today).

It says:

Any number of target_family key-value pairs can be set.

But I agree that having no example of this is confusing, I've opened rust-lang/cargo#14165 and rust-lang/reference#1518 to resolve this.

having a sort of build utils available from cargo

There is some recent work on this in rust-lang/cargo#12432.

@IceTDrinker
Copy link
Member

I see there is a formatting issue

Ah, sorry about this, I was somewhat lazy, and did this PR without fully setting up my editor :/. Have fixed it now, and actually tested that it works.

one note however reading the docs on the topic really does not make it clear (in my opinion) that it can be multi valued, and no such multi valued example is provided (I'm guessing because it can't happen today).

It says:

Any number of target_family key-value pairs can be set.

But I agree that having no example of this is confusing, I've opened rust-lang/cargo#14165 and rust-lang/reference#1518 to resolve this.

having a sort of build utils available from cargo

There is some recent work on this in rust-lang/cargo#12432.

Thanks for the links, as for the docs, it says multiple pairs but I don’t see comma separated list as pairs 😅

in any cas thanks, merged and 0.4.1 is live wont’ hamper future crater runs

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

Successfully merging this pull request may close these issues.

3 participants