Closed warpkwd closed 1 day ago
Thanks for pointing out. The o/p must be according to what user provided. It should be SPDX-2.2
instead of SPDX-2.3
. And whereas coming to the score, it could vary depending on the standard set. For instance, that could be if version is greater than or equal to 2.3, then score it as 10.0 or zero, kind of.
Thanks @warpkwd for raising this issue, it's a bug and will fix it out !!
This is an upstream issue. Because the value itself of s.doc.SPDXVersion
returns SPDX-2.3
, which means spdx_json
is parsing document incorrectly, d, err = spdx_json.Read(f)
.
var d *spdx.Document
switch format {
case FileFormatJSON:
d, err = spdx_json.Read(f)
case FileFormatTagValue:
d, err = spdx_tv.Read(f)
case FileFormatYAML:
d, err = spdx_yaml.Read(f)
case FileFormatRDF:
d, err = spdx_rdf.Read(f)
default:
err = fmt.Errorf("unsupported spdx format %s", string(format))
}
Where, spdx_json
is github.com/spdx/tools-golang/json
And the problem with spdx_tv
"github.com/spdx/tools-golang/tagvalue" too.
I have reproduce the issue for tools-golang/json
and tools-golang/tagvalue
here.
Thank you.
Concluding the response: https://github.com/spdx/tools-golang/issues/248#issuecomment-2462434308
Hey @warpkwd, The tools-golang library is designed to convert all SPDX documents to the latest supported version (currently 2.3), even if the input file specifies an older version (such as 2.2). This approach simplifies handling multiple SPDX versions by standardizing them to a single format, avoiding the need to write separate code for each version.
@riteshnoronha should we conclude with a NOTE: spdx version with 2.1, 2.2, 2.3 will be converted to 2.3(or latest, in future it will be 3.0) as per designed in the tools-golang library.
@warpkwd , this will be fixed in next release.
SPDX-2.3
, the same will be the o/p for corresponding field specification version
and score will be 10.0
SPDX-2.2
or SPDX-2.1
, the same will be the o/p for corresponding field specification version
and score will be 0.0
SPDX Version always return SPDX-2.3. But, Is this the correct specification?
SPDXJSONExample-v2.2.spdx.json is:
I think this is because of the following code:
https://github.com/spdx/tools-golang/blob/main/spdx/model.go