tool_getparam: let --trace-config override -v

If --trace-config is used to set a level before -v is used, don't reset
the state on first -v (to "-all") as it otherwise does. This way,
--trace-config can be used to set specific trace items before -v on the
command line and it still works.

Previously, the first -v use would otherwise reset and undo the earlier
--trace-config items.

Fixes #18346
Closes #18361
This commit is contained in:
Daniel Stenberg 2025-08-22 16:58:28 +02:00
parent 455cd07410
commit ebff00f1af
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 3 additions and 2 deletions

View file

@ -383,6 +383,7 @@ struct GlobalConfig {
BIT(silent); /* do not show messages, --silent given */
BIT(noprogress); /* do not show progress bar */
BIT(isatty); /* Updated internally if output is a tty */
BIT(trace_set); /* --trace-config has been used */
};
struct OperationConfig *config_alloc(void);

View file

@ -1477,7 +1477,7 @@ static ParameterError parse_verbose(bool toggle)
else if(!verbose_nopts) {
/* fist `-v` in an argument resets to base verbosity */
global->verbosity = 0;
if(set_trace_config("-all"))
if(!global->trace_set && set_trace_config("-all"))
return PARAM_NO_MEM;
}
/* the '%' thing here will cause the trace get sent to stderr */
@ -2443,6 +2443,7 @@ static ParameterError opt_filestring(struct OperationConfig *config,
/* 0 is a valid value for this timeout */
break;
case C_TRACE_CONFIG: /* --trace-config */
global->trace_set = TRUE;
if(set_trace_config(nextarg))
err = PARAM_NO_MEM;
break;

View file

@ -866,7 +866,6 @@ sub singletest_run {
else {
$cmdargs .= "--trace-ascii $LOGDIR/trace$testnum ";
}
$cmdargs .= "--trace-config all ";
$cmdargs .= "--trace-time ";
if($run_event_based) {
$cmdargs .= "--test-event ";