Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/jqPublic
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Validate JSON for --jsonarg#2658

Merged
nicowilliams merged 1 commit intojqlang:masterfromwader:jsonarg-is-valid
Jul 5, 2023

Conversation

wader
Copy link
Member

Fixes#2572

fprintf(stderr, "%s: invalid JSON text passed to --jsonargs\n", progname);
die();
}
ARGS = jv_array_append(ARGS, v);
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A bit of duplication here. I guess one could extract to some kind of parse_or_die function? could be use for--argjson code also. Maybe for later?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nah, it's fine.

exit 1
fi
# this tests the args_done code path "--"
$JQ -n --jsonargs null -- invalid && EC=$? || EC=$?
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not sure if this should be exit 2 (usage error?) or invalid input error?

I also noticed that we skip using $VALGRIND is some places, should we fix that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We're not very consistent regarding exit status codes. It'd be nice if a) we documentedjq's exit codes besides in the-e case, b) maybe made sure that the various usage and system error exit codes differ from the ones for-e?. But that's not for this issue.

And yes, we should fix the non-use of valgrind, but we should do so separately.

@nicowilliamsnicowilliams merged commit95625c3 intojqlang:masterJul 5, 2023
@nicowilliams
Copy link
Contributor

Thanks!

wader reacted with hooray emoji

@waderwader deleted the jsonarg-is-valid branchJuly 5, 2023 22:50
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicowilliamsnicowilliamsnicowilliams left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Assertion failure when using --jsonargs with invalid JSON and printing $ARGS
2 participants
@wader@nicowilliams

[8]ページ先頭

©2009-2025 Movatter.jp