Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package trurl for openSUSE:Factory checked in at 2024-08-02 17:26:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/trurl (Old) and /work/SRC/openSUSE:Factory/.trurl.new.7232 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "trurl" Fri Aug 2 17:26:58 2024 rev:13 rq:1191036 version:0.14 Changes: -------- --- /work/SRC/openSUSE:Factory/trurl/trurl.changes 2024-06-03 17:43:30.635138445 +0200 +++ /work/SRC/openSUSE:Factory/.trurl.new.7232/trurl.changes 2024-08-02 17:27:37.878031747 +0200 @@ -1,0 +2,10 @@ +Mon Jul 29 20:00:22 UTC 2024 - Martin Hauke <mar...@gmx.de> + +- Update to version 0.14 + * remove a suprious trailing newline from a warning. + * trurl.1: document the exit codes. + * add "strict:" as prefix to a get component. + * casecompare: a strncasemp replacement. + * support conditionally set scheme. + +------------------------------------------------------------------- Old: ---- trurl-0.13.tar.gz New: ---- trurl-0.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ trurl.spec ++++++ --- /var/tmp/diff_new_pack.OJJWt7/_old 2024-08-02 17:27:38.802069851 +0200 +++ /var/tmp/diff_new_pack.OJJWt7/_new 2024-08-02 17:27:38.802069851 +0200 @@ -18,7 +18,7 @@ Name: trurl -Version: 0.13 +Version: 0.14 Release: 0 Summary: Command line tool for URL parsing and manipulation License: MIT ++++++ trurl-0.13.tar.gz -> trurl-0.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trurl-trurl-0.13/RELEASE-NOTES new/trurl-trurl-0.14/RELEASE-NOTES --- old/trurl-trurl-0.13/RELEASE-NOTES 2024-05-15 08:23:20.000000000 +0200 +++ new/trurl-trurl-0.14/RELEASE-NOTES 2024-07-29 21:30:02.000000000 +0200 @@ -1,17 +1,13 @@ -# trurl 0.13 +# trurl 0.14 ## What's Changed - - (also) support --flag=argument style for long options - - fix unchecked return values from libcurl calls - - fixed typos - - free allocated pointer on OOM error - - memdupdec: free memory in OOM exit path - - only --append in the first iterate loop - - short options need no space separation for the argument anymore - - support ?= for set, to only do it if not already set - - trurl.1: use present tense +- remove a suprious trailing newline from a warning +- trurl.1: document the exit codes +- add "strict:" as prefix to a get component +- casecompare: a strncasemp replacement +- support conditionally set scheme Contributors to this release: - Daniel Gustafsson, Daniel Stenberg, Jacob Mealey, Viktor Szakats + Daniel Stenberg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trurl-trurl-0.13/tests.json new/trurl-trurl-0.14/tests.json --- old/trurl-trurl-0.13/tests.json 2024-05-15 08:23:20.000000000 +0200 +++ new/trurl-trurl-0.14/tests.json 2024-07-29 21:30:02.000000000 +0200 @@ -2544,5 +2544,62 @@ "stderr": "", "returncode": 0 } + }, + { + "input": { + "arguments": [ + "https://curl.se?name=mr%00smith", + "--get", + "{query}" + ] + }, + "expected": { + "stderr": "trurl note: URL decode error, most likely because of rubbish in the input (query)\n", + "returncode": 0, + "stdout": "\n" + } + }, + { + "input": { + "arguments": [ + "https://curl.se?name=mr%00smith", + "--get", + "{strict:query}" + ] + }, + "expected": { + "stderr": "trurl error: problems URL decoding query\ntrurl error: Try trurl -h for help\n", + "returncode": 10, + "stdout": "" + } + }, + { + "required": ["no-guess-scheme"], + "input": { + "arguments": [ + "example.com", + "--set", + "scheme?=https" + ] + }, + "expected": { + "stdout": "https://example.com/\n", + "stderr": "", + "returncode": 0 + } + }, + { + "input": { + "arguments": [ + "ftp://example.com", + "--set", + "scheme?=https" + ] + }, + "expected": { + "stdout": "ftp://example.com/\n", + "stderr": "", + "returncode": 0 + } } ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trurl-trurl-0.13/trurl.1 new/trurl-trurl-0.14/trurl.1 --- old/trurl-trurl-0.13/trurl.1 2024-05-15 08:23:20.000000000 +0200 +++ new/trurl-trurl-0.14/trurl.1 2024-07-29 21:30:02.000000000 +0200 @@ -109,10 +109,17 @@ not have a value. Components are shown URL decoded by default. If you instead write the -component prefixed with a colon like "{:path}", it gets output URL encoded. +component prefixed with "url:" like "{url:path}", it gets output URL encoded. +As a shortcut, "url:" also works written as a single colon: "{:path}". -You may also prefix components with \fBdefault:\fP and/or \fBpuny:\fP or \fBidn:\fP, -in any order. +URL decoding a component may cause problems to display it. Such problems make +a warning get displayed unless \fB--quiet\fP is used. URL decode problems can +optionally be turned into errors by prefixing the comopnent name with +"strict:", as in "{strict:path}". In this stricter mode, a URL decode problem +makes trurl stop what it is doing and return with exit code 10. + +You may also prefix components with \fBdefault:\fP and/or \fBpuny:\fP or +\fBidn:\fP, in any order. If \fBdefault:\fP is specified, like "{default:url}" or "{default:port}", and the port is not explicitly specified in the URL, @@ -431,6 +438,32 @@ ftp://curl.se/path/index.html sftp://curl.se/path/index.html .fi +.SH "EXIT CODES" +trurl returns a non-zero exit code to indicate problems. +.IP 1 +A problem with --url-file +.IP 2 +A problem with --append +.IP 3 +A command line option misses an argument +.IP 4 +A command line option mistake or an illegal option combination. +.IP 5 +A problem with --set +.IP 6 +Out of memory +.IP 7 +Could not output a valid URL +.IP 8 +A problem with --trim +.IP 9 +If --verify is set and the input URL cannot parse. +.IP 10 +A problem with --get +.IP 11 +A problem with --iterate +.IP 12 +A problem with --replace or --force-replace .SH WWW https://curl.se/trurl .SH "SEE ALSO" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trurl-trurl-0.13/trurl.c new/trurl-trurl-0.14/trurl.c --- old/trurl-trurl-0.13/trurl.c 2024-05-15 08:23:20.000000000 +0200 +++ new/trurl-trurl-0.14/trurl.c 2024-07-29 21:30:02.000000000 +0200 @@ -46,8 +46,6 @@ #include "version.h" #ifdef _MSC_VER -#define strncasecmp _strnicmp -#define strcasecmp _stricmp #define strdup _strdup #endif @@ -74,6 +72,11 @@ #if CURL_AT_LEAST_VERSION(7,30,0) #define SUPPORTS_IMAP_OPTIONS #endif +#if CURL_AT_LEAST_VERSION(8,9,0) +#define SUPPORTS_NO_GUESS_SCHEME +#else +#define CURLU_NO_GUESS_SCHEME 0 +#endif #define OUTPUT_URL 0 /* default */ #define OUTPUT_SCHEME 1 @@ -151,6 +154,52 @@ } #endif +/* Mapping table to go from lowercase to uppercase for plain ASCII.*/ +static const unsigned char touppermap[256] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, +22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, +41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, +60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, +79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 65, +66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, +85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, +134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, +150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, +166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, +182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, +198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, +214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, +230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, +246, 247, 248, 249, 250, 251, 252, 253, 254, 255 +}; + +/* Portable, ASCII-consistent toupper. Do not use toupper() because its + behavior is altered by the current locale. */ +#define raw_toupper(in) touppermap[(unsigned int)in] + +/* + * casecompare() does ASCII based case insensitive checks, as a strncasecmp + * replacement. + */ + +static int casecompare(const char *first, const char *second, size_t max) +{ + while(*first && *second && max) { + int diff = raw_toupper(*first) - raw_toupper(*second); + if(diff) + /* get out of the loop as soon as they don't match */ + return diff; + max--; + first++; + second++; + } + if(!max) + return 0; /* identical to this point */ + + return raw_toupper(*first) - raw_toupper(*second); +} +#define strncasecmp(x,y,z) casecompare(x,y,z) + static void message_low(const char *prefix, const char *suffix, const char *fmt, va_list ap) { @@ -232,30 +281,33 @@ fprintf(stdout, "%s version %s libcurl/%s [built-with %s]\n", PROGNAME, TRURL_VERSION_TXT, data->version, LIBCURL_VERSION); fprintf(stdout, "features:"); -#ifdef SUPPORTS_PUNYCODE - if(supports_puny) - fprintf(stdout, " punycode"); -#endif -#ifdef SUPPORTS_ALLOW_SPACE - fprintf(stdout, " white-space"); -#endif -#ifdef SUPPORTS_ZONEID - fprintf(stdout, " zone-id"); +#ifdef SUPPORTS_IMAP_OPTIONS + if(supports_imap) + fprintf(stdout, " imap-options"); #endif -#ifdef SUPPORTS_URL_STRERROR - fprintf(stdout, " url-strerror"); +#ifdef SUPPORTS_NO_GUESS_SCHEME + fprintf(stdout, " no-guess-scheme"); #endif #ifdef SUPPORTS_NORM_IPV4 fprintf(stdout, " normalize-ipv4"); #endif -#ifdef SUPPORTS_IMAP_OPTIONS - if(supports_imap) - fprintf(stdout, " imap-options"); +#ifdef SUPPORTS_PUNYCODE + if(supports_puny) + fprintf(stdout, " punycode"); #endif #ifdef SUPPORTS_PUNY2IDN if(supports_puny) fprintf(stdout, " punycode2idn"); #endif +#ifdef SUPPORTS_URL_STRERROR + fprintf(stdout, " url-strerror"); +#endif +#ifdef SUPPORTS_ALLOW_SPACE + fprintf(stdout, " white-space"); +#endif +#ifdef SUPPORTS_ZONEID + fprintf(stdout, " zone-id"); +#endif fprintf(stdout, "\n"); exit(0); @@ -757,6 +809,7 @@ size_t vlen; bool isquery = false; bool queryall = false; + bool strict = false; /* strict mode, fail on URL decode problems */ int mods = 0; end = strchr(ptr, endbyte); ptr++; /* pass the { */ @@ -766,39 +819,44 @@ continue; } - /* {path} {:path} */ + /* {path} {:path} {/path} */ if(*ptr == ':') { mods |= VARMODIFIER_URLENCODED; ptr++; } vlen = end - ptr; do { + size_t wordlen; cl = memchr(ptr, ':', vlen); if(!cl) break; + wordlen = cl - ptr + 1; /* modifiers! */ - if(!strncmp(ptr, "default:", cl - ptr + 1)) + if(!strncmp(ptr, "default:", wordlen)) mods |= VARMODIFIER_DEFAULT; - else if(!strncmp(ptr, "puny:", cl - ptr + 1)) { + else if(!strncmp(ptr, "puny:", wordlen)) { if(mods & VARMODIFIER_PUNY2IDN) errorf(o, ERROR_GET, "puny modifier is mutually exclusive with idn"); mods |= VARMODIFIER_PUNY; } - else if(!strncmp(ptr, "idn:", cl - ptr + 1)) { + else if(!strncmp(ptr, "idn:", wordlen)) { if(mods & VARMODIFIER_PUNY) errorf(o, ERROR_GET, "idn modifier is mutually exclusive with puny"); mods |= VARMODIFIER_PUNY2IDN; } + else if(!strncmp(ptr, "strict:", wordlen)) + strict = true; + else if(!strncmp(ptr, "url:", wordlen)) + mods |= VARMODIFIER_URLENCODED; else { - /* {query: or {query-all: */ - if(!strncmp(ptr, "query-all:", cl - ptr + 1)) { + if(!strncmp(ptr, "query-all:", wordlen)) { isquery = true; queryall = true; } - else if(!strncmp(ptr, "query:", cl - ptr + 1)) + else if(!strncmp(ptr, "query:", wordlen)) isquery = true; else { /* syntax error */ @@ -844,7 +902,10 @@ /* silently ignore */ break; default: - trurl_warnf(o, "%s (%s)\n", curl_url_strerror(rc), v->name); + if((rc == CURLUE_URLDECODE) && strict) + errorf(o, ERROR_GET, "problems URL decoding %s", v->name); + else + trurl_warnf(o, "%s (%s)", curl_url_strerror(rc), v->name); break; } } @@ -929,7 +990,7 @@ if(conditional) { char *piece; - rc = curl_url_get(uh, v->part, &piece, 0); + rc = curl_url_get(uh, v->part, &piece, CURLU_NO_GUESS_SCHEME); if(!rc) { skip = true; curl_free(piece); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trurl-trurl-0.13/version.h new/trurl-trurl-0.14/version.h --- old/trurl-trurl-0.13/version.h 2024-05-15 08:23:20.000000000 +0200 +++ new/trurl-trurl-0.14/version.h 2024-07-29 21:30:02.000000000 +0200 @@ -24,6 +24,6 @@ * ***************************************************************************/ -#define TRURL_VERSION_TXT "0.13" +#define TRURL_VERSION_TXT "0.14" #endif