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

tidy: Better license checks. #69443

Merged
merged 8 commits into from
Mar 19, 2020
Merged

tidy: Better license checks. #69443

merged 8 commits into from
Mar 19, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Feb 24, 2020

This implements some improvements to the license checks in tidy:

  • Use cargo_metadata instead of parsing vendored crates. This allows license checks to run without vendoring enabled, and allows the checks to run on PR builds.
  • Check for stale entries.
  • Check that the licenses for exceptions are what we think they are.
  • Verify exceptions do not leak into the runtime.

Closes #62618
Closes #62619
Closes #63238 (I think)

There are some substantive changes here. The follow licenses have changed from the original comments:

  • openssl BSD+advertising clause to Apache-2.0
  • pest MPL2 to MIT/Apache-2.0
  • smallvec MPL2 to MIT/Apache-2.0
  • clippy lints MPL2 to MIT OR Apache-2.0

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 24, 2020
@ehuss
Copy link
Contributor Author

ehuss commented Feb 24, 2020

cc @brson @gnzlbg FYI

];

/// These are the root crates that are part of the runtime. The licenses for
/// these and all their dependencies *must not* be in the exception list.
const RUNTIME_CRATES: &[&str] = &["std", "core", "alloc", "panic_abort", "panic_unwind"];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am assuming libtest is not really considered the "runtime" in the same vein as std is, but I can add it if people think it should. It adds a number of dependencies, but they are all permissively licensed.

Copy link
Member

Choose a reason for hiding this comment

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

I think this should include libtest, particularly as it might be linked in for e.g. black_box even in non-test executables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. It can always be revisited if someone wants to add an exception, it's probably better to be safer here. (although black_box is in core now, right?)

Just FYI for anyone curious, test adds the following dependencies:

  • getopts
  • proc_macro
  • rustc-std-workspace-std
  • term
  • test
  • unicode-width

Copy link
Contributor

Choose a reason for hiding this comment

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

I would add test as a runtime crate just to be on the conservative side. test will still be linked at runtime, (while procmacro etc. won't). Even if it is just in the test binary, it might still be confusing that the Rust compiler produces binaries with different license checking guarantees.

Comment on lines +439 to +438
// Build dependencies *shouldn't* matter unless they do some kind of
// codegen. For now we'll assume they don't.
Copy link
Contributor Author

@ehuss ehuss Feb 24, 2020

Choose a reason for hiding this comment

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

I could change this to include build deps if people think it should. That is, should we restrict the licenses of build deps of libstd in case they inject code into the resulting crate?

"winapi-util",
"winapi-x86_64-pc-windows-gnu",
"wincolor",
"hermit-abi",
Copy link
Member

Choose a reason for hiding this comment

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

Since we're changing the whole list anyway, mind sorting it while we're at it?

// This package doesn't declare a license expression. Manual
// inspection of the license file is necessary, which appears
// to be BSD-3-Clause.
assert!(pkg.license.is_none());
Copy link
Member

Choose a reason for hiding this comment

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

cc @cramertj (?) -- could we get this populated perhaps?

@nikomatsakis
Copy link
Contributor

cc @skade

@Dylan-DPC-zz
Copy link

r? @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

I'm going to r? @skade here since they've been involved with license work

@skade
Copy link
Contributor

skade commented Mar 12, 2020

r+

I'm okay with this, with the comment that I posted above: #69443 (comment). This probably merits its own ticket and shouldn't be discussed in a comment section, it's rather unclear what the story there should be. Is test part of the runtime or not?

Thanks for the patch, @ehuss

@Mark-Simulacrum
Copy link
Member

@bors r=skade,Mark-Simulacrum

I've done my best to also check the implementation, and it looks correct to me.

@bors
Copy link
Contributor

bors commented Mar 12, 2020

📌 Commit 432bec14aefc3c23b4d4a4c8d8fb873eb6da9c81 has been approved by skade,Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 12, 2020
@ehuss
Copy link
Contributor Author

ehuss commented Mar 13, 2020

@bors r=skade,Mark-Simulacrum
Some tests were broken since this was opened (removed chalk-engine and chalk-macros from exception list, removed in #69247).

@bors
Copy link
Contributor

bors commented Mar 13, 2020

📌 Commit ed0158d has been approved by skade,Mark-Simulacrum

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 17, 2020
…mulacrum

tidy: Better license checks.

This implements some improvements to the license checks in tidy:

* Use `cargo_metadata` instead of parsing vendored crates. This allows license checks to run without vendoring enabled, and allows the checks to run on PR builds.
* Check for stale entries.
* Check that the licenses for exceptions are what we think they are.
* Verify exceptions do not leak into the runtime.

Closes rust-lang#62618
Closes rust-lang#62619
Closes rust-lang#63238 (I think)

There are some substantive changes here. The follow licenses have changed from the original comments:

* openssl BSD+advertising clause to Apache-2.0
* pest MPL2 to MIT/Apache-2.0
* smallvec MPL2 to MIT/Apache-2.0
* clippy lints MPL2 to MIT OR Apache-2.0
Centril added a commit to Centril/rust that referenced this pull request Mar 19, 2020
…mulacrum

tidy: Better license checks.

This implements some improvements to the license checks in tidy:

* Use `cargo_metadata` instead of parsing vendored crates. This allows license checks to run without vendoring enabled, and allows the checks to run on PR builds.
* Check for stale entries.
* Check that the licenses for exceptions are what we think they are.
* Verify exceptions do not leak into the runtime.

Closes rust-lang#62618
Closes rust-lang#62619
Closes rust-lang#63238 (I think)

There are some substantive changes here. The follow licenses have changed from the original comments:

* openssl BSD+advertising clause to Apache-2.0
* pest MPL2 to MIT/Apache-2.0
* smallvec MPL2 to MIT/Apache-2.0
* clippy lints MPL2 to MIT OR Apache-2.0
bors added a commit that referenced this pull request Mar 19, 2020
Rollup of 9 pull requests

Successful merges:

 - #69036 (rustc: don't resolve Instances which would produce malformed shims.)
 - #69443 (tidy: Better license checks.)
 - #69814 (Smaller and more correct generator codegen)
 - #69929 (Regenerate tables for Unicode 13.0.0)
 - #69959 (std: Don't abort process when printing panics in tests)
 - #69969 (unix: Set a guard page at the end of signal stacks)
 - #70005 ([rustdoc] Improve visibility for code blocks warnings)
 - #70088 (Use copy bound in atomic operations to generate simpler MIR)
 - #70095 (Implement -Zlink-native-libraries)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Mar 19, 2020
Rollup of 9 pull requests

Successful merges:

 - #68941 (Properly handle Spans that reference imported SourceFiles)
 - #69036 (rustc: don't resolve Instances which would produce malformed shims.)
 - #69443 (tidy: Better license checks.)
 - #69814 (Smaller and more correct generator codegen)
 - #69929 (Regenerate tables for Unicode 13.0.0)
 - #69959 (std: Don't abort process when printing panics in tests)
 - #69969 (unix: Set a guard page at the end of signal stacks)
 - #70005 ([rustdoc] Improve visibility for code blocks warnings)
 - #70088 (Use copy bound in atomic operations to generate simpler MIR)

Failed merges:

r? @ghost
@bors bors merged commit 61fe2e4 into rust-lang:master Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
7 participants