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

Cargo IANAL #1396

Open
Stebalien opened this issue Dec 6, 2015 · 20 comments
Open

Cargo IANAL #1396

Stebalien opened this issue Dec 6, 2015 · 20 comments
Labels
T-dev-tools Relevant to the development tools team, which will review and decide on the RFC.

Comments

@Stebalien
Copy link
Contributor

It would be really nice to have a cargo command that analizes all dependencies and:

  1. Verifies that the licenses are compatible.
  2. Informs the user about any additional use/distribution restrictions.
  3. Helps the user choose an appropriate license (if not already specified).

This doesn't have to cover all licenses, just the common ones (MIT, Apache2, the GPLs, the BSDs, etc...).

@huonw
Copy link
Member

huonw commented Dec 6, 2015

Do you know of any preexisting data for 1 and 2 that cargo can reuse?

@Stebalien
Copy link
Contributor Author

For 1, there's this for GPL compatibility... That's why I said we should start with common ones. Unfortunately, license compatibility is not transitive so a full license compatibility matrix is very verbose.

@ticki
Copy link
Contributor

ticki commented Dec 6, 2015

Big 👍. It would be very nice to have such feature.

@rphmeier
Copy link

rphmeier commented Dec 6, 2015

This, or something like it, is really necessary in my eyes. Since you can easily rack up tons of transitive dependencies with just a couple direct ones, it would be nice to have a tool like this.

I don't know if there's a 'crates.io user agreement' but there should also be some kind of terms you have to agree to before uploading your crate which states that the license you specify in your Cargo.toml overrides any other licenses in your repository, for those rare cases someone might put down MIT and actually uses GPL.

IANAL, not sure how fully legally binding that would be.

@jethrogb
Copy link
Contributor

Automated license-compatibility checking is really complicated if not impossible. For example, there is no automated way to tell the difference between a derived work and a combined work. The main problem here is that you don't want Cargo to have something declared OK which turns out to be not OK.

It would be nice though to have a command that lists all dependencies and their licenses.

@Stebalien
Copy link
Contributor Author

Automated license-compatibility checking is really complicated if not impossible.

This isn't automated license-compatibility checking. This is automated project compatibility checking using a precomputed license compatibility matrix of common licenses. (see the gnu link above). This is totally doable for a small set of well understood, common licenses.

@jethrogb
Copy link
Contributor

Just came across this somewhat relevant article today: Streamlining license compliance with FOSSology 3.0

@Nemo157
Copy link
Member

Nemo157 commented Mar 7, 2016

I've been meaning to do something like this for a while and finally got round to finishing my prototype and pushing it to github: https://github.com/Nemo157/cargo-lichking.

@ticki
Copy link
Contributor

ticki commented Apr 8, 2016

A basic matrix, which should cover the majority of cases:

COMPATIBLE WITH >  PD  MIT  BSD  AL  LGPL  LGPL+  LGPL3  MPL  GPL  GPL+  GPL3  AGPL
Public Domain      ✔   ✔    .    .   .     .      .      .    .    .     .     .
MIT                .   ✔    ✔    .   .     .      .      .    .    .     .     .
BSD-new            .   .    ✔    ✔   ✔     ✔      ✔      ✔    .    .     .     .
Apache 2.0         .   .    .    ✔   .     .      ✔      .    .    .     .     .
LGPLv2.1           .   .    .    .   ✔     .      .      .    ✔    ✔     .     .
LGPLv2.1+          .   .    .    .   ✔     ✔      ✔      .    ✔    .     .     .
LGPLv3(+)          .   .    .    .   .     .      ✔      .    .    .     ✔     .
MPL 1.1            .   .    .    .   .     .      .      ✔    .    .     .     .
GPLv2              .   .    .    .   .     .      .      .    ✔    .     .     .
GPLv2+             .   .    .    .   .     .      .      .    ✔    ✔     ✔     .
GPLv3(+)           .   .    .    .   .     .      .      .    .    .     ✔     ✔
AGPL               .   .    .    .   .     .      .      .    .    .     .     ✔

@tbu-
Copy link
Contributor

tbu- commented Apr 24, 2016

@ticki Are these licenses really that incompatible? Can't I have a GPL program that has a Apache or MIT dependency?

@Nemo157
Copy link
Member

Nemo157 commented Apr 24, 2016

@tbu- according to Wikipedia, gnu.org and http://www.dwheeler.com/essays/floss-license-slide.html you can. Maybe @ticki's matrix is assuming the compatability is transitive and not showing that explicitly?

@burdges
Copy link

burdges commented Apr 24, 2016

@ticki's matrix is completely wrong, maybe even if you check everything under the diagonal.

If you've no problem with any common licenses, then you only need to worry about mutual incompatibilities, probably only Apache vs (L)GPLv2 and MPL 1 vs GPL. Now the GPLv3 has resolved compatibility issues with Apache and [https://www.fsf.org/blogs/licensing/mpl-2.0-release](MPL 2 resolved compatibility issues with the GPL).

At this point, I think the major source of problems for common licenses issue is Apple's AppStore restrictions, which seem incompatible with third parties developers using GPLed libraries. There are rumors the FSF might eventually develop an AppStore amenable license based around reproducible builds, but that's probably years off.

@ticki
Copy link
Contributor

ticki commented Apr 24, 2016

@burdges @Nemo157 @tbu- It is based on the fact that these licenses are transitive with each other. If you extend the set, it might not be transitive, though.

@Stebalien
Copy link
Contributor Author

@ticki That's why we need something more extensive than a simple matrix.

@Nemo157
Copy link
Member

Nemo157 commented Apr 24, 2016

Pretty sure a matrix does work, I basically used one for cargo-lichking: https://github.com/Nemo157/cargo-lichking/blob/master/src/license.rs although that doesn't assume any kind of transitivity of the relationship and just has a fully specified matrix.

@raphaelcohn
Copy link

In practice, this kind of thing is more complex, particularly because there's an implicit difference between the licence for the whole, and the licence for the source. The former incorporates the source along with not only artifacts, but the way in which it is structured, delivered, organised or even marketed (!) Oh, and then one has to add in legal domain (country, and, in places like the UK, region; eg how Scots law works here with overlap) and choice of vendoring author / legal entity (company).

So the most useful thing a tool could do is show license usage as SPDX codes (or, ideally, as SPDX codes as per the Debian COPYRIGHT file format, which is more subtle) by crate, by type of dependency. And even then, it wouldn't be 100% right. For example, take clippy. It gets listed as a dependency because it's a compiler plugin, but it's actually never shipped in a binary... so if clippy was AGPL, say, it wouldn't actually virally infest any other code.

I would suggest we look at adopting Debian's COPYRIGHT file format for cargo, though. It's something I've used for a couple of years now, and it makes documenting license details, copyright statements and authorship transparent and explicit. Of course, it would mean writing a parser for Debian-style files, but that wouldn't be a bad thing at all. And they're not hard.

@glandium
Copy link

glandium commented Jul 9, 2016

There are other considerations than straight license compatibility. For an example I have been directly involved with, the LGPL was designed against closed-source software, at the expense of copyleft free software. So even though LGPL and MPL are compatible, there are redistristribution constraints that forces Mozilla to distribute binary code from LGPL source code in a separate shared library instead of statically linking it like everything else. These kind of problems are especially hitting Rust code, since the Rust compiler defaults to static linking.

@nrc nrc added the T-dev-tools Relevant to the development tools team, which will review and decide on the RFC. label Aug 19, 2016
@xizhao
Copy link

xizhao commented Jan 5, 2019

https://github.com/fossas/fossa-cli accomplishes this, and is OSS -- a PR could be a great home for cargo support

@realHorst
Copy link

https://github.com/fossas/fossa-cli accomplishes this, and is OSS -- a PR could be a great home for cargo support

I do not think fossa qualifies as an open source tool. Only their client is open, the analysis is done on their servers.

@phoepsilonix
Copy link

For example, if a Linux distributor is creating a package, they may wish to have the ability to check the licence list of the relevant crate as a standard feature of cargo.
It is hoped that functions such as cargo-lichking and cargo-license will become standard features.

cargo lichking bundle

The above features would be eagerly awaited by distributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-dev-tools Relevant to the development tools team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests