-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
output errors do not lead to a non-zero exit code #305
Comments
It returns 0 when it can parse the URL, which it can in your examples. You might want |
I'm not sure we're talking about the same thing here, because even with
|
Yes, because it returns 0 when it can parse the URL and it only adds a "note" about the problem to output what was asked. We should probably consider making the output problems return non-zero as well. |
Most typically when %00 or something crazy is used in the component and it is extracted URL decoded. Makes trurl return ERROR_GET (10) now. Added two tests to verify. Reported-by: yahesh on github Fixes #305
It struck me we don't return error for those because you might pass in many URLs, and if you get a problem with For example , this is a legit command line:
|
@bagder Curl has support for a |
It's not about "more strict" though. The new option would probably be documented as "return error if failing to produce output" or something. I think |
At the end, the decision is up to you, but I don't understand why you say that
|
The strict prefix makes trurl immediately exit with an error code if such a get can't be done due to URL decoding problems. By default, such a problem will only make trurl skip that part and silently continue. Use it like this: --get "{strict:query}" I also made "url:" a valid prefix, and now we consider the single colon prefix to be a shortcut for url:. The concept of prefixes scale better when we use real words instead of single characters. Ref: #305
I created #310, which instead adds a prefix for the get component to ask for "strict" or regular. |
@yahesh that would make your command lines above return errors in the way you wanted them to, right? |
When providing
trurl
with a URL-encoded component that it is unhappy with (e.g. using URL-encoded characters smaller than%20
) then the tool will not decode the component as requested but output a "trurl note", swallowing all output and only returning a single line break while the exit code is still0
. This is even the case with the--verify
option set.This could severely break pipelines that use
trurl
on untrusted URLs. Currently, tools usingtrurl
cannot distinguish between successful parsing and URL-decoding errors based on the exit codes.The text was updated successfully, but these errors were encountered: