anthonyharrison / distro2SBOM

Generates SBOM files from system packaging information
Apache License 2.0
10 stars 7 forks source link

Running without `--name` and `--release` throws `IndexError: list index out of range` #8

Closed aristotelos closed 6 months ago

aristotelos commented 8 months ago

Running with --package but without --name and --release throws an error IndexError: list index out of range.

(test-env) [user@my ~]$ distro2sbom --distro rpm --package xyz--output-file xyz-rpm.cdx.json
Traceback (most recent call last):
  File "/home/ansible/test-env/bin/distro2sbom", line 8, in <module>
    sys.exit(main())
  File "/home/ansible/test-env/lib64/python3.9/site-packages/distro2sbom/cli.py", line 206, in main
    sbom_build = RpmBuilder(args["name"], args["release"], args["debug"])
  File "/home/ansible/test-env/lib64/python3.9/site-packages/distro2sbom/distrobuilder/rpmbuilder.py", line 22, in __init__
    self.system_data = self.get_system()
  File "/home/ansible/test-env/lib64/python3.9/site-packages/distro2sbom/distrobuilder/distrobuilder.py", line 81, in get_system
    metadata[data[0].lower()] = data[1].replace('"', "").strip()
IndexError: list index out of range

It seems adding --name xyz --release xyz fixes the command, but it does not add much additional information to the SBOM.

anthonyharrison commented 6 months ago

Fixed in release 0.4.1