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

Asserts with side effects #9981

Open
Buristan opened this issue Apr 27, 2024 · 0 comments
Open

Asserts with side effects #9981

Buristan opened this issue Apr 27, 2024 · 0 comments
Labels
bug Something isn't working code health Improve code readability, simplify maintenance and so on

Comments

@Buristan
Copy link
Collaborator

Buristan commented Apr 27, 2024

A quick grep inside our codebase found several places where assert has side effects (due to typos in them, I suppose).

grep -n -A1 'assert([^=]*[^!<>=~]=$' -R src/
src/box/sql/build.c:3664:       assert(sql_session_opts[id - SESSION_SETTING_SQL_BEGIN].field_type =
src/box/sql/build.c-3665-              FIELD_TYPE_STRING);
grep 'assert(.*[^!<>=~]=[^=]' -R src/
src/box/lua/net_box.c:  assert(transport->self_ref = LUA_NOREF);
src/box/xrow_update_bar.c:      assert(op->opcode == '='); # it's OK

IINM, @mkokryashkin has some ideas about preventing this from happening in the future.

@Buristan Buristan added bug Something isn't working code health Improve code readability, simplify maintenance and so on labels Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code health Improve code readability, simplify maintenance and so on
Projects
None yet
Development

No branches or pull requests

1 participant