+ goto error;
+ }
+
+ /*
+ * Append parameters and log levels of all the
+ * non-option arguments that contributed to this
+ * component instance coming into existence.
+ */
+ orig_indices_count = bt_value_array_get_length(res->original_input_indices);
+ for (orig_indices_i = 0; orig_indices_i < orig_indices_count; orig_indices_i++) {
+ const bt_value *orig_idx_value =
+ bt_value_array_borrow_element_by_index(
+ res->original_input_indices, orig_indices_i);
+ uint64_t orig_idx = bt_value_integer_unsigned_get(orig_idx_value);
+ const bt_value *params_array =
+ bt_value_array_borrow_element_by_index_const(
+ non_opt_params, orig_idx);
+ uint64_t params_i, params_count;
+ const bt_value *loglevel_value;
+
+ params_count = bt_value_array_get_length(params_array);
+ for (params_i = 0; params_i < params_count; params_i++) {
+ const bt_value *params_value =
+ bt_value_array_borrow_element_by_index_const(
+ params_array, params_i);
+ const char *params = bt_value_string_get(params_value);
+ bt_value_array_append_element_status append_status;
+
+ append_status = bt_value_array_append_string_element(
+ comp->extra_params, "--params");
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
+ BT_CLI_LOGE_APPEND_CAUSE("Failed to append array element.");
+ goto error;
+ }
+
+ append_status = bt_value_array_append_string_element(
+ comp->extra_params, params);
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
+ BT_CLI_LOGE_APPEND_CAUSE("Failed to append array element.");
+ goto error;
+ }
+ }
+
+ loglevel_value = bt_value_array_borrow_element_by_index_const(
+ non_opt_loglevels, orig_idx);
+ if (bt_value_get_type(loglevel_value) == BT_VALUE_TYPE_STRING) {
+ const char *loglevel = bt_value_string_get(loglevel_value);
+ bt_value_array_append_element_status append_status;
+
+ append_status = bt_value_array_append_string_element(
+ comp->extra_params, "--log-level");
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
+ BT_CLI_LOGE_APPEND_CAUSE("Failed to append array element.");
+ goto error;
+ }
+
+ append_status = bt_value_array_append_string_element(
+ comp->extra_params, loglevel);
+ if (append_status != BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
+ BT_CLI_LOGE_APPEND_CAUSE("Failed to append array element.");
+ goto error;
+ }
+ }
+ }
+
+ /*
+ * If single input and a src.ctf.fs component, provide the
+ * relative path from the path passed on the command line to the
+ * found trace.
+ */
+ if (bt_value_array_get_length(res->inputs) == 1 &&
+ strcmp(res->plugin_name, "ctf") == 0 &&
+ strcmp(res->source_cc_name, "fs") == 0) {
+ const bt_value *orig_idx_value =
+ bt_value_array_borrow_element_by_index(
+ res->original_input_indices, 0);
+ uint64_t orig_idx = bt_value_integer_unsigned_get(orig_idx_value);
+ const bt_value *non_opt_value =
+ bt_value_array_borrow_element_by_index_const(
+ non_opts, orig_idx);
+ const char *non_opt = bt_value_string_get(non_opt_value);
+ const bt_value *input_value =
+ bt_value_array_borrow_element_by_index_const(
+ res->inputs, 0);
+ const char *input = bt_value_string_get(input_value);
+
+ BT_ASSERT(orig_indices_count == 1);
+ BT_ASSERT(g_str_has_prefix(input, non_opt));
+
+ input += strlen(non_opt);
+
+ while (G_IS_DIR_SEPARATOR(*input)) {
+ input++;
+ }
+
+ if (strlen(input) > 0) {
+ append_string_parameter_to_args(comp->extra_params,
+ "trace-name", input);
+ }