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

tvloader: Error when Snippet does not immediately follow its File section #124

Closed
CatalinStratu opened this issue Mar 28, 2022 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@CatalinStratu
Copy link
Contributor

When two identical files are inserted, the error below appears.
image

The file that I used when I identified this error is: https://github.com/spdx/spdx-spec/blob/development/v2.2.2/examples/SPDXTagExample-v2.2.spdx

I want to mention that the SnippetSPDXID tag is in both files.

@swinslow
Copy link
Member

Thanks for filing this @CatalinStratu -- I'm taking a look now to see whether this is an issue with the example / sample document, or with the tvloader parser.

As mentioned here, note though that I think the files being compared in this example are not actually identical. That shouldn't cause the parsing issue here, but just flagging to avoid confusion.

@swinslow swinslow added the bug Something isn't working label Mar 31, 2022
@swinslow swinslow added this to the 0.3.0 milestone Mar 31, 2022
@swinslow swinslow changed the title Error in example_licensediff when two equal files are entered as input tvloader: Error when Snippet does not immediately follow its File section Mar 31, 2022
@swinslow
Copy link
Member

OK -- so it looks like this is a parsing error in tvloader, due to an ambiguity in the SPDX spec. See spdx/spdx-spec#651 for more details.

Basically, one possible reading of the spec says that, for tag-value files, a Snippet section should always come immediately after the File section that "contains" it. But a different reading is just that the Snippet needs to be somewhere after the corresponding File, even if it's not immediately after it.

The current tvloader code takes the first reading, and because of that it assumes that a SnippetSPDXID tag will only appear when it's in the middle of parsing a File section. So in the sample file at examples/sample-docs/tv/SPDXTagExample-v2.2.spdx, it hits a parsing failure when it encounters the SnippetSPDXID tag coming after a Package section.

We'll need to see how spdx/spdx-spec#651 is resolved before we can address this here. That means we'll kick this down the road to 0.4.0.

In the meantime, for the 0.3.0 release I'm going to add another different sample document, so that example 6 can be run without erroring out.

@swinslow swinslow self-assigned this Mar 31, 2022
@swinslow swinslow modified the milestones: 0.3.0, 0.4.0 Apr 3, 2022
@CatalinStratu
Copy link
Contributor Author

@swinslow I would like to work on this issue, can you give me some suggestions on where I can look for the problem? Thanks!

@CatalinStratu
Copy link
Contributor Author

Hi @swinslow, this problem was solved by @ianling in the PR #133

@CatalinStratu
Copy link
Contributor Author

This problem was solved in the PR #133

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

No branches or pull requests

2 participants