Skip to content

Parser throwing exception #154

Closed
Closed

Description

@rjb4standards

PackageName:spdx-tools
SPDXID: SPDXRef-spdx-tools-0.6.1
PackageSupplier: Person:Ahmed H. Ismail
PackageVersion: 0.6.1

Is throwing an exception on this spdx SBOM data: https://raw.githubusercontent.com/rjb4standards/REA-Products/master/SAG-DBOMPOC-SBOM.spdx

Here is the exception I'm seeing:
<class 'TypeError'> 'builtin_function_or_method' object is not subscriptable <traceback object at 0x000001B8B16DC0C8>

Activity

  1. rjb4standards commented on Dec 20, 2020

    @rjb4standards
    Author

    Gary, I was able to get a successful validation with the online validator for https://github.com/rjb4standards/REA-Products/blob/master/SAG-PM.spdx
    However, I'm seeing these errors from the python parser for the same file:
    PackageChecksum must be a single line of text, line: 15
    false
    Only one PackageName allowed, extra at line: 22

    Any suggestions on how to get around this?

  2. goneall commented on Dec 20, 2020

    @goneall
    Member

    Ahhh - the Python Parser - Now everything makes sense.

    The Python Parser is maintained in a different repo, I'll move this issue over.

    You can disregard my above comments.

    I'll leave it up to the maintainers of the Python project to respond to the issues.

    In the interim, you can use the online tools at https://tools.spdx.org/app/ for validating the SPDX file.

    Once you have a validated file, give it a try using the Python parsers.

  3. transferred this issue fromspdx/toolson Dec 20, 2020
  4. rjb4standards commented on Mar 1, 2021

    @rjb4standards
    Author

    I found the culprit for this error too: PackageChecksum must be a single line of text, line: 15
    LOOKS LIKE SHA256 not supported, only SHA1 allowed:

    15: PackageChecksum: SHA256: aaa5ac584f40fe778013df0aa6544bf157799bd3f608364b451840ed2c8688de

    def checksum_from_sha1(value):
    """
    Return an spdx.checksum.Algorithm instance representing the SHA1
    checksum or None if does not match CHECKSUM_RE.
    """
    # More constrained regex at lexer level
    CHECKSUM_RE = re.compile("SHA1:\s([\S]+)", re.UNICODE)*
    match = CHECKSUM_RE.match(value)
    if match:
    return checksum.Algorithm(identifier="SHA1", value=match.group(1))
    else:
    return None

  5. meretp commented on Oct 14, 2022

    @meretp
    Collaborator

    related to #185

  6. meretp commented on Nov 28, 2022

    @meretp
    Collaborator

    Closing this issue as it should be solved with #311. Please reopen, if this is not the case.

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

    parserIssues related to the parser layer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions