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

Adding a license file during clarification doesn't work for nested files #521

Closed
Will-Low opened this issue Jun 14, 2023 · 2 comments · Fixed by #533
Closed

Adding a license file during clarification doesn't work for nested files #521

Will-Low opened this issue Jun 14, 2023 · 2 comments · Fixed by #533
Assignees
Labels
bug Something isn't working

Comments

@Will-Low
Copy link

Describe the bug
When I try to add multiple license files to the license-files field, and the path of one of those license files is nested in a subdirectory, I'm getting a "unable to locate specified license file" message.

To Reproduce
I'm adding a clarification for rustls-webpki. My clarification looks like:

[[licenses.clarify]]
name = "rustls-webpki"
expression = "BSD-3-Clause AND MPL-2.0"
license-files = [
    { path = "LICENSE", hash = 0x001c7e6c },
    { path = "third-party/chromium/LICENSE", hash = 0x001c7e6c },
]

The first license file is the MPL-2.0 and the second is the BSD-3-Clause. The path for the second file exists in the published crate. See https://docs.rs/crate/rustls-webpki/0.100.1/source/third-party/chromium/LICENSE.

Note that the hash for the second file is wrong; I don't know what it is yet to add it.

My output:

error[unlicensed]: rustls-webpki = 0.100.1 is unlicensed
   ┌─ /Users/NAME/repos/REPO/deny.toml:44:14
   │
44 │     { path = "third-party/chromium/LICENSE", hash = 0x001c7e6c },
   │              ------------------------------ unable to locate specified license file
   │
   ┌─ rustls-webpki 0.100.1 (registry+https://github.com/rust-lang/crates.io-index):2:9
   │
 2 │ name = "rustls-webpki"
   │         ^^^^^^^^^^^^^ a valid license expression could not be retrieved for the crate
 3 │ version = "0.100.1"
 4 │ license = ""
   │            - license expression was not specified
 5 │ license-files = [
 6 │     { path = "LICENSE", hash = 0x001c7e6c, score = 0.85, license = "ISC" },
   │                                                    ---- low confidence in the license text
   │
   = rustls-webpki v0.100.1
     └── rustls v0.21.0
         ...

warning[license-exception-not-encountered]: license exception was not encountered
   ┌─ /Users/NAME/repos/REPO/deny.toml:58:8
   │
58 │ name = "rustls-webpki"
   │        ^^^^^^^^^^^^^^^ unmatched license exception

licenses FAILED

Expected behavior
I would expect an error telling me that the crate is unlicensed, giving me the hash of the second license file, which I would then include.

Device:

  • OS: macOS 13.4
@Will-Low Will-Low added the bug Something isn't working label Jun 14, 2023
@Jake-Shadle Jake-Shadle self-assigned this Jun 15, 2023
@Jake-Shadle
Copy link
Member

Note that while I am fixing this because it is a bug, the particular error case in the description is unnecessary IMO, the third-party/chromium/LICENSE applies to the test data in that directory which is only used for the internal crate testing, and not part of the actual distributed crate package.

@Jake-Shadle
Copy link
Member

Oh and even better, later versions of rustls-webpki also just correctly set the license field so clarifications are not even needed.

Jake-Shadle added a commit that referenced this issue Jul 26, 2023
- Fixup license clarification
- Add clarification example
- Add test

Resolves: #521 
Resolves: #524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants