mirror of https://github.com/sysown/proxysql
All three files had the same incorrectly-grouped failure check at the
heart of their variable-comparison loop. The intended semantics were:
if special_sqlmode is true AND verified_special_sqlmode is false, fail
or if k == mysql_vars.end(), fail
or if s == proxysql_vars["conn"].end(), fail
or if special_sqlmode is false AND the inner disjunction holds, fail
where the inner disjunction is
(el.key() != "session_track_gtids" && values differ)
OR
(el.key() == "session_track_gtids" && check_session_track_gtids(...) fails)
Because C++ '&&' binds tighter than '||', the source
(special_sqlmode == false &&
(el.key() != "session_track_gtids" && (...)) ||
(el.key() == "session_track_gtids" && !check_session_track_gtids(...))
)
actually parsed as
( special_sqlmode == false && (el.key() != "session_track_gtids" && (...)) )
||
(el.key() == "session_track_gtids" && !check_session_track_gtids(...))
i.e. the 'session_track_gtids' branch was promoted to a standalone
failure condition that fired even when special_sqlmode == true (or in
set_testing-240-t.cpp, also when parsing_optimizer_switch == true).
This caused tests to flag spurious failures whenever session_track_gtids
disagreed in the "we intentionally don't care about this iteration"
cases.
-Wparentheses flagged all three files. Fix is one extra pair of
parentheses around the inner disjunction so it's truly guarded by the
outer special_sqlmode / parsing_optimizer_switch condition.
Compile-verified with -fsyntax-only -Wall on all three files.
lint-tap-tests-static-analysis
parent
20036eb54e
commit
a6b8afa1f2
Loading…
Reference in new issue