Repository navigation
Conversation
44df221 to
5ee4c4d
Compare
|
Analysis of PR #20113 at 5ee4c4d5: Test ../../tests/http/test_07_upload.py::TestUpload::test_07_70_put_earlydata[h3-limited-body] failed, but it has been 0.6% flaky lately, so it's probably NOT a fault of the PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Generated by Testclutch |
| if(result) { | ||
| /* bad globbing */ | ||
| warnf("bad output glob"); | ||
| warnf("bad output filename"); |
There was a problem hiding this comment.
This fixes the sanitizer case, but would this also be accurate
for real globbing and URL issues returned by glob_match_url()?
It can return CURLE_FAILED_INIT, CURLE_OUT_OF_MEMORY,
also CURLE_TOO_LARGE via dynbuf. Only CURLE_URL_MALFORMAT
means that the sanitizier found an issue in the output filename. (and not
in the URL / globbing.)
There was a problem hiding this comment.
I believe it is still a better error message. It explains that the problem is with the filename, which previously was not easy to understand.
There was a problem hiding this comment.
Definitely better for the filename case, but may be confusing to see 'filename' in the unlikely case of a failure dealing with the input URL:
Output when glob_match_url returns CURLE_OUT_OF_MEMORY:
$ ./curl 'https://curl.se/[0-1]' --output out.out
Warning: bad output filename
curl: (27) Out of memory
Also the CURLE_URL_MALFORMAT code returned is weird in the filename case,
because the error isn't with the URL. It'd probably need a new error code.
PR attempting to fix both, and one more corner case: #20116
|
See #20121 for a different way. The sanitizer should only fail if the path is too long so I'm proposing a warning specifically for that in the sanitizer. The way in this PR may have problems which Viktor already mentioned and that it should be left as a bad glob message |
…n fails On MS-DOS (OOM and bad filename) and Windows (OOM only). Given the rarity of both platform and error, we make a compromise and return an unrelated libcurl error (43) in case of a bad output filename on MS-DOS. After: ``` $ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/ --output out.txt curl: (27) Out of memory $ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/ --output out.txt Warning: bad output filename curl: (43) A libcurl function was given a bad argument $ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/index.html --globoff -O curl: (27) Out of memory $ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/index.html --globoff -O curl: bad output filename curl: (43) A libcurl function was given a bad argument ``` Before: ``` $ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/ --output out.txt Warning: bad output glob curl: (27) Out of memory $ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/ --output out.txt Warning: bad output glob curl: (3) URL using bad/illegal format or missing URL $ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/index.html --globoff -O curl: Failed to extract a filename from the URL to use for storage curl: (27) Out of memory $ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/index.html --globoff -O curl: Failed to extract a filename from the URL to use for storage curl: (3) URL using bad/illegal format or missing URL ``` Ref: #20116 (simpler reboot of) Ref: #20113 #20121 Ref: 40c1748 #20198 Ref: eb7f5b7 #20143 Ref: 8c02407 #20125 Fixes #20044 Closes #20199
if for example sanitize_file_name deems it bad, saying
bad output filenameseems much better thanbad output glob.Reported-by: Viktor Szakats
Ref: #20044