From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (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 DE06B43D67A for ; Thu, 17 Oct 2019 23:00:45 +0300 (MSK) Received: by mail-lf1-f68.google.com with SMTP id r22so2890193lfm.1 for ; Thu, 17 Oct 2019 13:00:45 -0700 (PDT) Date: Thu, 17 Oct 2019 23:00:42 +0300 From: Cyrill Gorcunov Message-ID: <20191017200042.GC9698@uranus.lan> References: <6de1f18613e9b6a3f716c60b9c85457d2bd9eb64.1571341771.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6de1f18613e9b6a3f716c60b9c85457d2bd9eb64.1571341771.git.v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 1/1] console: fix usage of an undeclared variable List-Id: Tarantool development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org On Thu, Oct 17, 2019 at 09:50:44PM +0200, Vladislav Shpilevoy wrote: > Console client's eval() method in case of an error at > reading from a socket was trying to return a variable > declared in a different view scope. Instead, the > error should be raised to drop the connection. > --- > Branch: https://github.com/tarantool/tarantool/tree/gerold103/console-undefined-variable > > No test, because can be reproduced only in repl mode of a client. > > src/box/lua/console.lua | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua > index f70ed830a..52df67465 100644 > --- a/src/box/lua/console.lua > +++ b/src/box/lua/console.lua > @@ -451,7 +451,7 @@ local text_connection_mt = { > self.print_f(rc) > end > end > - return rc > + return error(self:set_error()) Wait ... local rc = self:read() if not rc then break end ... We're reading from a socket and there could be EOF, which will give us zero return code. But now we will start to yielding an error in this case.