scripts/sbom: catch ValueError from malformed shell quotingparse_inputs_from_commands() only caught CmdParsingError and IndexErrorwhen dispatching to command parsers, but several parsers callshle
scripts/sbom: catch ValueError from malformed shell quotingparse_inputs_from_commands() only caught CmdParsingError and IndexErrorwhen dispatching to command parsers, but several parsers callshlex.split() internally, which raises ValueError on malformed shellquoting (e.g. an unterminated quote). This exception was not caught,so a single malformed build command would abort SBOM generationentirely, even with fail_on_unknown_build_command=False, defeating thepurpose of tolerant mode.The issue was found while reviewing the exception handling around thesaved-command parser after running its existing tests. It can bereproduced with: parse_inputs_from_commands('gcc "unterminated', fail_on_unknown_build_command=False)Catch ValueError alongside CmdParsingError and IndexError so suchcommands are logged as a warning/error and skipped instead of abortingthe whole run.Add tests covering malformed shell quoting and a missing positionalargument.Signed-off-by: Carlos Sampaio Ribeiro <otakurack@gmail.com>Link: https://patch.msgid.link/20260719081859.1001-1-otakurack@gmail.comSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
scripts/sbom: add unit tests for command parsersAdd unit tests to verify that command parsers correctly extractinput files from build commands.Assisted-by: Cursor:claude-sonnet-4-5Assisted-by:
scripts/sbom: add unit tests for command parsersAdd unit tests to verify that command parsers correctly extractinput files from build commands.Assisted-by: Cursor:claude-sonnet-4-5Assisted-by: OpenCode:GLM-4-7Co-developed-by: Maximilian Huber <maximilian.huber@tngtech.com>Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com>Signed-off-by: Luis Augenstein <luis.augenstein@tngtech.com>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>