]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_urlglob: better 'Duplicate glob name' position
authorDaniel Stenberg <daniel@haxx.se>
Tue, 12 May 2026 14:01:41 +0000 (16:01 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 12 May 2026 21:46:04 +0000 (23:46 +0200)
This now points to where the duplicate name ends, not where it starts.

Also fixes test 2410 to use a fixed hostname so that the error position
remains the same.

Reported-by: Viktor Szakats
Fixes #21567
Closes #21568

src/tool_urlglob.c
tests/data/test2410

index 72893fe661853b2f4742f84ae8688fb650cf4d95..a0dbb0bb6f2e9ffb6fed7464be008920f0c01b6e 100644 (file)
@@ -524,7 +524,7 @@ static CURLcode glob_parse(struct URLGlob *glob, const char *pattern,
           /* check that the name is not already used */
           struct URLPattern *p = glob_find_name(glob, &name);
           if(p)
-            return globerror(glob, "Duplicate glob name", 2 + start - ipattern,
+            return globerror(glob, "Duplicate glob name", pattern - ipattern,
                              CURLE_URL_MALFORMAT);
           pos += (pattern - start);
         }
index fdec8c2e5d58ab7b7b545bd50298ea4fcd71d035..ce83263e532d9428c199e3780d7cccb913494be3 100644 (file)
@@ -12,23 +12,20 @@ globbing
 
 # Client-side
 <client>
-<server>
-http
-</server>
 <name>
 duplicate named glob
 </name>
 <command option="no-output">
-"%HOSTIP:%HTTPPORT/{%LTtest%GTA,B}{%LTtest%GTC,D}" -o "%LOGDIR/dump"
+"https://dummy.example/{%LTtest%GTA,B}{%LTtest%GTC,D}" -o "%LOGDIR/dump"
 </command>
 </client>
 
 # Verify data after the test has been "shot"
 <verify>
 <stderr mode="text">
-curl: (3) Duplicate glob name in position 30:
-%HOSTIP:%HTTPPORT/{%LTtest%GTA,B}{%LTtest%GTC,D}
-                             ^
+curl: (3) Duplicate glob name in position 40:
+https://dummy.example/{%LTtest%GTA,B}{%LTtest%GTC,D}
+                                       ^
 </stderr>
 <errorcode>
 3