From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 74A7D4765E0 for ; Sun, 27 Dec 2020 01:00:03 +0300 (MSK) Received: by mail-lf1-f51.google.com with SMTP id m12so16072320lfo.7 for ; Sat, 26 Dec 2020 14:00:03 -0800 (PST) Date: Sun, 27 Dec 2020 01:00:00 +0300 From: Cyrill Gorcunov Message-ID: <20201226220000.GF298600@grain> References: <20201226213809.511284-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201226213809.511284-1-gorcunov@gmail.com> Subject: Re: [Tarantool-patches] [PATCH] cfg: fix format in error message List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Cc: Vladislav Shpilevoy On Sun, Dec 27, 2020 at 12:38:09AM +0300, Cyrill Gorcunov wrote: > Coverity pointed that quorum value is int64_t > wide and could be trimmed in error message. Fix > it using proper formatting. Forgot to update the tests. Force pushed --- Coverity pointed that quorum value is int64_t and could be trimmed in error message. Fix it using a proper formatting. CID 1500388 Part-of #5446 Signed-off-by: Cyrill Gorcunov --- src/box/box.cc | 6 +++--- test/replication/gh-5446-qsync-eval-quorum.result | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index e1d8305c8..3c5873e3c 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -623,10 +623,10 @@ box_eval_replication_synchro_quorum(int nr_replicas) if (quorum <= 0 || quorum >= VCLOCK_MAX) { const char *msg = tt_sprintf("the formula is evaluated " - "to the quorum %d for replica " + "to the quorum %lld for replica " "number %d, which is out of range " - "[%d;%d]", - quorum, nr_replicas, 1, VCLOCK_MAX - 1); + "[%d;%d]", (long long)quorum, + nr_replicas, 1, VCLOCK_MAX - 1); diag_set(ClientError, ER_CFG, "replication_synchro_quorum", msg); return -1; diff --git a/test/replication/gh-5446-qsync-eval-quorum.result b/test/replication/gh-5446-qsync-eval-quorum.result index f33b20a8e..1d13f26db 100644 --- a/test/replication/gh-5446-qsync-eval-quorum.result +++ b/test/replication/gh-5446-qsync-eval-quorum.result @@ -41,12 +41,14 @@ box.cfg{replication_synchro_quorum = "N-1"} box.cfg{replication_synchro_quorum = '4294967296 + 1'} | --- | - error: 'Incorrect value for option ''replication_synchro_quorum'': the formula is - | evaluated to the quorum 1 for replica number 1, which is out of range [1;31]' + | evaluated to the quorum 4294967297 for replica number 1, which is out of range + | [1;31]' | ... box.cfg{replication_synchro_quorum = 'N + 4294967296'} | --- | - error: 'Incorrect value for option ''replication_synchro_quorum'': the formula is - | evaluated to the quorum 1 for replica number 1, which is out of range [1;31]' + | evaluated to the quorum 4294967297 for replica number 1, which is out of range + | [1;31]' | ... box.cfg{replication_synchro_quorum = 4294967297} | --- -- 2.26.2