Skip to content

Case insensitivity of license identifiers #94

Description

@aschierl-xitaso

Is your feature request related to a problem? Please describe.

The SPDX Specification 3.0.1 (and also 2.x) explains that license identifiers in SPDX documents should be matched case-insensitively:

License identifiers (including license exception identifiers) used in SPDX documents or source code files should be matched in a case-insensitive manner. In other words, MIT, Mit and mIt should all be treated as the same identifier and referring to the same license.

However, please be aware that it is often important to match with the case of the canonical identifier on the SPDX License List. This is because the canonical identifier's case is used in the URL of the license's or exception's entry on the List, and because the canonical identifier is translated to a URI in RDF documents.

In contrast, currently spdx::Expression::parse("mIt") will fail with ParseError { original: "mIt", span: 0..3, reason: UnknownTerm }.

Describe the solution you'd like
Do you plan to support case insensitivity when parsing license identifiers (by default, or as an optional parse mode)?

Describe alternatives you've considered

  • Parse license identifiers case-insensitively be default
  • Parse license identifiers case-insensitively as a configurable "case_insensitive" ParseMode
  • Parse license identifiers case-sensitively (not following the "should" in the specification)

Additional context

The SPDX Specification v3.1-RC1 makes this even clearer and more liberal:

In SPDX 3, license expressions are completely case-insensitive. That includes the operators ("AND", "OR", "WITH"), the special identifiers ("NONE" and "NOASSERTION"), as well as the license identifiers, including the user-defined ones.
For example, the expressions MIT AND NOASSERTION AND (BSD-3-Clause OR LicenseRef-Name) and mit aNd NoaSSerTion AnD (bSd-3-clausE OR licenseref-NAME) are equivalent.

(Though it's unclear if this change will make it into 3.1 like that, or be modified or reverted before the final stable release.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions