From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3FD5129218 for ; Wed, 27 Mar 2019 09:40:17 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wUzYNw0NWy2v for ; Wed, 27 Mar 2019 09:40:17 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id ED781291F4 for ; Wed, 27 Mar 2019 09:40:16 -0400 (EDT) From: Roman Khabibov Subject: [tarantool-patches] [PATCH] tarantoolctl: remove metatable assumptions in start() Date: Wed, 27 Mar 2019 16:40:14 +0300 Message-Id: <20190327134014.56676-1-roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: alexander.turenko@tarantool.org box.cfg{} metatables are uninitialized when start() called before box.cfg{}. It led to unexpected error. Closes #3953 --- Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3953-tctl Issue: https://github.com/tarantool/tarantool/issues/3953 extra/dist/tarantoolctl.in | 7 ------- test/app-tap/tarantoolctl.test.lua | 4 +++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in index 47fcf895f..91747e3ba 100755 --- a/extra/dist/tarantoolctl.in +++ b/extra/dist/tarantoolctl.in @@ -547,13 +547,6 @@ local function start() end os.exit(1) end - local old_call = getmetatable(box.cfg).__call - getmetatable(box.cfg).__call = function(old_cfg, cfg) - if old_cfg.pid_file ~= nil and cfg ~= nil and cfg.pid_file ~= nil then - cfg.pid_file = old_cfg.pid_file - end - old_call(old_cfg, cfg) - end return 0 end diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua index db046e03f..1755fcc66 100755 --- a/test/app-tap/tarantoolctl.test.lua +++ b/test/app-tap/tarantoolctl.test.lua @@ -165,10 +165,12 @@ do local dir = fio.tempdir() local code = [[ box.cfg{memtx_memory = 104857600} ]] create_script(dir, 'script.lua', code) + create_script(dir, 'init.lua', [[ print('Hi!') ]]) local status, err = pcall(function() test:test("basic test", function(test_i) - test_i:plan(16) + test_i:plan(18) + check_ok(test_i, dir, 'start', 'init.lua', 0, nil, "Starting instance init...") check_ok(test_i, dir, 'start', 'script', 0, nil, "Starting instance") tctl_wait_start(dir, 'script') check_ok(test_i, dir, 'status', 'script', 0, nil, "is running") -- 2.20.1 (Apple Git-117)