Skip to content

SPDX validation should consider arbitrary expressions in format <KNOWN-LICENSE-ID>"+" as valid #110

Open

Description

@jkowalleck

SPDX license expression allow the following Simple license expressions:

An SPDX License List Short Form Identifier with a unary "+" operator suffix to represent the current version of the license or any later version. For example: CDDL-1.0+

spec & docs:

request

make the validator and parser support SPDX License Identifiers with a + at the end.

reproduce

I tested with exactly this example CDDL-1.0+ value, but got a negative, where I expected a positive:

tested with license-expression==30.4.1

>>> from license_expression import get_spdx_licensing
>>> lic = get_spdx_licensing()

>>> lic.validate('CDDL-1.0')
ExpressionInfo(
    original_expression='CDDL-1.0',
    normalized_expression='CDDL-1.0',
    errors=[],
    invalid_symbols=[]
)

>>> lic.validate('CDDL-1.0+')
ExpressionInfo(
    original_expression='CDDL-1.0+',
    normalized_expression=None,
    errors=['Unknown license key(s): CDDL-1.0+'],
    invalid_symbols=['CDDL-1.0+']
)

>>> lic.validate('MIT OR CDDL-1.0+')
ExpressionInfo(
    original_expression='MIT OR CDDL-1.0+',
    normalized_expression=None,
    errors=['Unknown license key(s): CDDL-1.0+'],
    invalid_symbols=['CDDL-1.0+']
)

Activity

  1. changed the title [-]SPDX validation should consider `<LICENSE-ID>+` that are not in the database[/-] [+]SPDX validation should consider `<LICENSE-ID>+` as valid[/+] on Feb 13, 2025
  2. changed the title [-]SPDX validation should consider `<LICENSE-ID>+` as valid[/-] [+]SPDX validation should consider arbitrary expressins in format `<KNOWN-LICENSE-ID>+` as valid[/+] on Feb 13, 2025
  3. changed the title [-]SPDX validation should consider arbitrary expressins in format `<KNOWN-LICENSE-ID>+` as valid[/-] [+]SPDX validation should consider arbitrary expressins in format `<KNOWN-LICENSE-ID>"+"` as valid[/+] on Feb 13, 2025
  4. changed the title [-]SPDX validation should consider arbitrary expressins in format `<KNOWN-LICENSE-ID>"+"` as valid[/-] [+]SPDX validation should consider arbitrary expressions in format `<KNOWN-LICENSE-ID>"+"` as valid[/+] on Feb 13, 2025
  5. mjherzog commented on Feb 13, 2025

    @mjherzog
    Member

    The "+" format license identifiers were deprecated in favor of "or-later" long ago (Identifier list version 2.0rc2). I do no know the exact date but the latest version of the list in GitHub is v2.4 from 2016.

  6. pombredanne commented on Feb 13, 2025

    @pombredanne
    Member

    @jkowalleck We are not treating a trailing "+" as special. Instead, it needs to be included as an alternative license symbol. For instance see:
    https://github.com/aboutcode-org/scancode-toolkit/blob/e795bc6e1e531a0657b7be2363ec746520a5ae64/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE#L12

    Here CDDL-1.0+ is not a great example in all cases, because it the CDDL already allows other versions as shown below https://scancode-licensedb.aboutcode.org/cddl-1.0.html

    In recap, if you see examples of real usage of an unsupported trailing +, report them and we will add proper licenses (or alternative SPDX license keys) for them. I do not want to support a deprecated blanket generic + trailing/suffix otherwise. It was deprecated for a purpose, chiefly for its lack of purpose as a generic thing.

    1. Versions of the License.

    4.1. New Versions. Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.

    4.2. Effect of New Versions. You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.

  7. pombredanne commented on Feb 13, 2025

    @pombredanne
    Member

    And example of a fairly rare and fairly poor licensing statement is this:

    SPDX-License-Identifier: AFL-3.0+ OR Apache-2.0+ OR BSD-3-Clause+ OR CC-BY-4.0+ OR CDDL-1.0+ OR GPL-2.0-or-later OR MIT+

    In particular when a license has no version and no steward, this is pretty naive and ill informed IMHO. These will be treated as exceptions and detected correctly in ScanCode with custom rules, and as a last resort as alternative license keys, but I would not want to maintain generic code warts for a few rare weird stuffs.

  8. jkowalleck commented on Feb 13, 2025

    @jkowalleck
    Author

    Thanks for the explanation.
    I would be okay with closing this ticket

  9. pombredanne commented on Feb 13, 2025

    @pombredanne
    Member

    @jkowalleck I want to make sure we support these rare cases alright, either as detection rules or alternative keys, so we can keep this open. It is unfortunate that the SPDX spec and related docs provide weird examples by using the nonsensical CDDL-1.0+ in various places when this is redundant and essentially incorrect.

    And because of these warts, there are actual parsers that go to some length to support this for zero actual benefits.

    The same way GPL-2.0-or-later+ would make no sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions