]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: let --trace-config override -v bagder/trace-verbose 18361/head
authorDaniel Stenberg <daniel@haxx.se>
Fri, 22 Aug 2025 14:58:28 +0000 (16:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 22 Aug 2025 14:58:28 +0000 (16:58 +0200)
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

src/tool_cfgable.h
src/tool_getparam.c

index 23e874f448e74e9fe98844e0ae55a72c7ae8f407..5e7222a8a86d5de83462783a40f169dade863609 100644 (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);
index 475cbd4927ec7f8f2714a1ed4399b52db84abfb3..165a4bfb6a582226226329b94d3fc8a4a2fe6001 100644 (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;