Fix: `babeltrace2 convert`: don't consider the `--plugin-path` opt.
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 7 Feb 2024 17:02:04 +0000 (12:02 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 7 Feb 2024 20:16:40 +0000 (15:16 -0500)
OBSERVED ISSUE
══════════════
When running the (default) `convert` command of the CLI and passing
`--plugin-path` _after_ a conversion argument, the program aborts:

    $ babeltrace2 /some/path --plugin-path=/meow/mix
    [1]    87823 IOT instruction (core dumped)  babeltrace2 /some/path --plugin-path=/meow/mix

I expect such a command line to gracefully tell me that `--plugin-path`
is an unknown option.

CAUSE
═════
This is due to the `convert` command considering the general
`--plugin-path` option (part of the `convert_options` array), but then
not ignoring it during one of its passes.

`--plugin-path` is a general option, not a conversion option. Therefore,
it must not be part of `--plugin-path`.

SOLUTION
════════
Remove the `OPT_PLUGIN_PATH` entry from the `convert_options` array in
`babeltrace2-cfg-cli-args.c`.

The output of the command line above is now:

    ERROR:    [Babeltrace CLI] (babeltrace2.c:2655)
      Command-line error: retcode=1
    CAUSED BY [Babeltrace CLI] (babeltrace2-cfg-cli-args.c:1427)
      While parsing `convert` command's command-line arguments: While
      parsing argument #3
      (`--plugin-path=data/plugins/src.ctf.fs/field/`): Unknown option
      `--plugin-path`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8b22c5f732aae9fd1f3c989bd5aaef2d461d4160
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11756
Tested-by: jenkins <jenkins@lttng.org>
src/cli/babeltrace2-cfg-cli-args.c

index a0da0ddf52d43e268806003813f856c8678bd9c5..2fdadf219958088e13c5122a9fc445945df65464 100644 (file)
@@ -2422,7 +2422,6 @@ const struct argpar_opt_descr convert_options[] = {
        { OPT_OUTPUT, 'w', "output", true },
        { OPT_OUTPUT_FORMAT, 'o', "output-format", true },
        { OPT_PARAMS, 'p', "params", true },
-       { OPT_PLUGIN_PATH, '\0', "plugin-path", true },
        { OPT_RETRY_DURATION, '\0', "retry-duration", true },
        { OPT_RUN_ARGS, '\0', "run-args", false },
        { OPT_RUN_ARGS_0, '\0', "run-args-0", false },
This page took 0.026369 seconds and 4 git commands to generate.