spdx / spdx/LicenseListPublisher

Alt match cannot be used inside copyrightText

Open
#162 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Java
Stars
23
Forks
29
Avg merge
6h 31m
Merged PRs (30d)
2

Description

When adding Latex2e-translated-notice in https://github.com/spdx/license-list-XML/pull/1932, I wanted a @copyright{} string in a copyrightText block to be an alternation to a Unicode © string. My motivation was to match both source in texinfo language and a rendered text.

It turned out that licenseListPublisher-2.2.8.jar was unable to handle it. It seems that the curly brackets are separated from the adjacent "copyright" word before the alternation match is performed.

Here is a minimal reproducer:

$ cat src/test.xml
<?xml version="1.0" encoding="UTF-8"?>
<SPDXLicenseCollection xmlns="http://www.spdx.org/license">
   <license isOsiApproved="false" licenseId="test"
   name="test alt match with curly brackets" listVersionAdded="0">
     <text>
       <copyrightText>
         <p>
           before <alt name="symbol" match="@copyright\{\}">@copyright{}</alt> after
           <!--before @copyright{} after-->
         </p>
       </copyrightText>
     </text>
   </license>
</SPDXLicenseCollection>

$ cat test/simpleTestForGenerator/test.txt 
before @copyright{} after

$ ./test-one-license test
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Difference found comparing to test file: Unable to find the text ' after  ";match=".{0,5000}">>
' following a variable rule 'symbol' starting at line #1 column #20 ""

If the alternation is out of copyrightText block, it works.

Maybe related issues: #87, #100.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproducer in src/test.xml and test/simpleTestForGenerator/test.txt, then run ./test-one-license test to observe the failure. Trace how the licenseListPublisher tool handles alt matches within copyrightText; done means the @copyright{} alternation matches successfully there as it does outside the block.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.