Skip to content
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

Rename VSB_QUOTE_JSON and prepare VSB_quote_*() for returning errors #3972

Closed
wants to merge 2 commits into from

Conversation

nigoroll
Copy link
Member

@nigoroll nigoroll commented Sep 1, 2023

We rename our existing JSON quoting to make clear that it is not quite JSON.

For standard JSON quoting, we are going to need to signal failures, so prepare VSB_quote*() for that.

This is in preparation of adding back standard conforming JSON
encoding later.
The upcoming JSON encoding will need a way to signal
encoding failure.

The patch was produced using coccinelle, except for vsb.c
and vsb.h
@dridi
Copy link
Member

dridi commented Sep 1, 2023

I find this too intrusive.

In general adding a return value to VSB_quote*() is a good idea, but instead of guarding against failure everywhere, we should relax the return value check for flexelint. This is what we do in many places: feed the VSB and wait until VSB_finish() to check for errors. Consumers of VSB_quote*() may otherwise perform early checks when relevant.

Even worse, the indiscriminate coccinelle patch added assertion to panic code paths, potentially raising a signal inside a signal handler.

I think we should limit the change to vsb.c, vsb.h and /flint.lnt.

I haven't thought about the JSON part of the change.

@dridi
Copy link
Member

dridi commented Sep 1, 2023

Also, this is an ABI breaking change that would probably require a major soname bump of libvarnishapi.

@nigoroll
Copy link
Member Author

nigoroll commented Sep 1, 2023

Discussed on IRC: @bsdphk does not see standard conforming JSON encoding as a core function of VSB, so together with @dridi's objections, the API change is dead.
I wonder if we should still do the JSON->VJSON rename to make it obvious that it's not-quite-json.

@nigoroll
Copy link
Member Author

nigoroll commented Sep 1, 2023

I wonder if we should still do the JSON->VJSON rename to make it obvious that it's not-quite-json.

dismissed on irc

@nigoroll nigoroll closed this Sep 1, 2023
@nigoroll nigoroll deleted the vjson branch September 1, 2023 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants