From 75f82af83bc25adb7e3309c75df45f7003ea6e3c Mon Sep 17 00:00:00 2001
From: bigbes <bigbes@gmail.com>
Date: Thu, 15 Sep 2016 18:12:03 +0300
Subject: [PATCH] Fix for arg handling in tarantoolctl

---
 extra/dist/tarantoolctl.in         | 3 +--
 test/replication/autobootstrap.lua | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index ab93f9ef81..fb5f294619 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -357,8 +357,6 @@ end
 local orig_cfg = box.cfg
 
 local function wrapper_cfg(cfg)
-    shift_argv(arg, 0, 2)
-
     for i, v in pairs(default_cfg) do
         if cfg[i] == nil then
             cfg[i] = v
@@ -411,6 +409,7 @@ local function start()
         script_name = instance_path,
         __defer_update = true
     }
+    shift_argv(arg, 0, 2)
     local success, data = pcall(dofile, instance_path)
     -- if load fails - show last 10 lines of the log file
     if not success then
diff --git a/test/replication/autobootstrap.lua b/test/replication/autobootstrap.lua
index ca3d7fd218..a72a619dea 100644
--- a/test/replication/autobootstrap.lua
+++ b/test/replication/autobootstrap.lua
@@ -1,7 +1,7 @@
 #!/usr/bin/env tarantool
 
 -- get instance name from filename (autobootstrap1.lua => autobootstrap1)
-local INSTANCE_ID = string.match(arg[2], "%d")
+local INSTANCE_ID = string.match(arg[0], "%d")
 local USER = 'cluster'
 local PASSWORD = 'somepassword'
 local SOCKET_DIR = require('fio').cwd()
-- 
GitLab