Skip to content

license-file without license seems ill-advised #8537

@cuviper

Description

@cuviper

Problem

If you include both license and license-file in Cargo.toml, you get a warning:

if project.license_file.is_some() && project.license.is_some() {
manifest.warnings_mut().add_warning(
"only one of `license` or \
`license-file` is necessary"
.to_string(),
);
}

However, crates.io doesn't know how to describe an arbitrary license-file, so it ends up being called "non-standard", which is rather poor for the user. Maybe this could be considered a crates.io issue, but I don't think they should be expected to guess what the SPDX license is from a file. When multiple files are supported (#5933), it really can't know whether that should be AND or OR.

For example, see the difference between pretty-git-prompt 0.2.0 and 0.2.1, which dropped the license field on cargo's recommendation.

Steps

  1. Add both license and license-file
  2. $ cargo package
    warning: only one of `license` or `license-file` is necessary
  3. If published with just license-file, crates.io calls the license "non-standard".

Possible Solution(s)

I think maybe it should be a warning if only license-file is present, since license is better for providing SPDX to show on crates.io.

Notes

Output of cargo version:

cargo 1.46.0-nightly (43cf77395 2020-07-13)

And that warning is still on master as of aa68721, as linked above.

cc tokio-rs/tracing#842

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-licenseArea: license handlingA-manifestArea: Cargo.toml issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions