-
Notifications
You must be signed in to change notification settings - Fork 10
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
satisfies("MIT", "MIT AND Apache-2.0) passes, but is expected to fail #14
Comments
I think of the first argument as the license expression for an artifact and the second argument as the license expression for a policy about which terms are acceptable. The algorithm is essentially defined by the examples in |
@kemitchell in the first example:
I think it's confusing to use At the very least, if the order of the arguments is relevant then the argument names themselves shouldn't be |
@kemitchell Would you be open to re-evaluating the behavior described in the title? While trying to address this feature request we started using This behavior contradicts our expectations given the spec descriptions (linked by @dangoor above). |
|
@kemitchell, I think the error might be in the flatten function. Could you please clarify what it is supposed to do?
expanded is evaluated to be
which to me seems to be making sense so I think the issue is with this reduce since the key
I would have expected it though to be something like
Could you please clarify if my understanding is correct? I can create a PR for this |
👋 Hi @kemitchell, just a bump on @cnagadya's question for clarification -- we're happy to submit a PR to resolve this but want to make sure we're doing it right 🙏 |
I'd be happy to see a PR, but my personal view on this package at the moment is that use of the SPDX expression syntax for the second argument was very likely a mistake. A very small number of users likely want to allow specific licenses with exceptions, but mostly what people want is to call |
Hi all👋. I've also come across unexpected behaviour with this package recently, and was hoping to get some help understand. According to my probably mistaken interpretation, based on the examples provided in the README, both arguments should be strings with a valid SPDX expression. On the other hand, what would make sense to me when executing
The same goes for @kemitchell is my interpretation mistaken? |
See #17. The decision to take two SPDX expressions as arguments has caused far too much confusion. |
Thanks for your fast reply. I have a PR ready in case you'd like to keep the argument comparison working with 2 strings, which fits my use case. Actually, I believe both approaches ( |
@kemitchell Please, see #18. Thanks in advance. |
What's the use case for expression-versus-expression, specifically? |
Sorry, but isn't that the original purpose of this package? I mean, judging by the examples on the README I would assume it allows comparing expressions. For instance: satisfies('MIT AND ISC', '(MIT OR GPL-2.0) AND ISC') In our case, we use it to compare the licenses of every package on the |
I believe the original issue here has now been avoided. Per #17, we're no longer accepting |
Sorry again, but I don't understand why |
Description
For
function satisfies(first, second)
, my reading of the parameters is that the check is determining if the first expression satisfies the second. If this is correct, then I expect...I expect it to return
false
sinceMIT AND Apache-2.0
requires both licenses to be present.Similar results:
I expect it to return
false
sinceMIT AND ICU
does not satisfy any conditions in the second expression.Analysis
With the second expression flattened, it appears to act as
Apache-2.0 OR MIT
andMIT
does satisfy that expression resulting in a return value oftrue
.Similar result:
Since
ICU
andMIT
are both in the flattened list,satisfies
returnstrue
. ButMIT AND ICU
do not match any of the conditions in the second expression, so I would expectfalse
.Exploration
I tried flipping the processing such that the second expression is expanded and the first is flattened. With that,
satisfies("MIT", "MIT AND Apache-2.0")
returnsfalse
as expected. This leads to new failures in the set of assertions in the readme.Example:
The assertion is written to expect satisfies to return
false
, but I would expect this to returntrue
sinceGPL-2.0
in the first expression satisfiesISC OR GPL-2.0
.This leads me to wonder if I am misinterpreting the meaning of the two parameters in the context of which parameter is the test and which is the expression to be satisfied.
The text was updated successfully, but these errors were encountered: