From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id F207E6EC55; Thu, 26 Aug 2021 23:21:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F207E6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1630009265; bh=u+6DpZpdYv1REtsTgMhF51sBIQi+Ge6LvyekoahA+qA=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=LgxC4uzW2ghMXT7JV1KF8O9yxFMB4xoWoQsn04agxalhwQl5gyaD57ZNur9fPyfTo O2nzEYHxlR+zLp+eBrcyrdYghUroIwj4jHhX5fEFelhA3pq1nCAALkBswmTJfGQK14 PQOVasaVI/nBA233GydsaVH8ahCR2eN7GBJ97Ofc= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 780176EC55 for ; Thu, 26 Aug 2021 23:21:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 780176EC55 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mJLry-0007Fd-MK; Thu, 26 Aug 2021 23:21:03 +0300 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <7c4620245d61624883115541490cd94d10626c00.1629976113.git.imeevma@gmail.com> Message-ID: <40a89d61-e252-731c-d419-6c162eecefb4@tarantool.org> Date: Thu, 26 Aug 2021 22:21:01 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <7c4620245d61624883115541490cd94d10626c00.1629976113.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD910164DC12A5633065676A9727AC27C74182A05F53808504039508A3D883BB1EB4BC8FA4893762C0041DADD0160F72A4BCD6AA3923A42FFF2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE745229D52CF30560CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063725D748B084CAA27D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DCA6CBF62A42385EE1EE9D946F62438E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209ECD01F8117BC8BEA471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C565C1E6824D8037B43847C11F186F3C59DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505BFD030A668ACDA91096D0F414E87A8DA X-C1DE0DAB: 0D63561A33F958A5C0FFBEC6F6B091D256F86D46B7965572CC4ED37FECCCD73BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA756665624D6DDF07B5410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C1E32F4AD4B2486BDECC5CBF926BF141247D911134752557DFE4FF31165AE0F47C236F1C14F654D91D7E09C32AA3244C2C241D02F30ADBEDDB30BB38E27492C755E75C8D0ED9F6EE729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+bzRAXO2P1SCQ+CVLMWPCQ== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D33B17A87D4232C6C69B7B202CEA83F873841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: fix error on copy empty string in mem_copy() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! See 3 comments below. > diff --git a/test/sql-tap/gh-6157-unnecessary-free-on-string.c b/test/sql-tap/gh-6157-unnecessary-free-on-string.c > new file mode 100644 > index 000000000..ce928d494 > --- /dev/null > +++ b/test/sql-tap/gh-6157-unnecessary-free-on-string.c > @@ -0,0 +1,10 @@ > +#include "msgpuck.h" > +#include "module.h" > + > +int > +f(box_function_ctx_t* ctx, const char* args, const char* args_end) 1. '*' must be right before variable name, not after the types. > +{ > + char res[16]; > + char *end = mp_encode_str(res, "stub", strlen("stub")); > + return box_return_mp(ctx, res, end); > +} 2. Why do you need a C function? Can't you reproduce it with Lua? > diff --git a/test/sql-tap/gh-6157-unnecessary-free-on-string.test.lua b/test/sql-tap/gh-6157-unnecessary-free-on-string.test.lua > new file mode 100755 > index 000000000..326570aea > --- /dev/null > +++ b/test/sql-tap/gh-6157-unnecessary-free-on-string.test.lua > @@ -0,0 +1,38 @@ > +#!/usr/bin/env tarantool > +local build_path = os.getenv("BUILDDIR") > +package.cpath = build_path..'/test/sql-tap/?.so;'..build_path..'/test/sql-tap/?.dylib;'..package.cpath > + > +local test = require("sqltester") > +test:plan(1) > + > +box.schema.func.create("gh-6157.f", { > + language = "C", > + param_list = {"string"}, > + returns = "string", > + exports = {"SQL"} > +}) > + > +box.execute([[CREATE TABLE ts(s STRING PRIMARY KEY);]]) > +box.execute([[INSERT INTO ts VALUES ('');]]) > +box.execute([[CREATE TABLE ti(i INT PRIMARY KEY);]]) > +for i = 1, 100 do > + box.execute([[INSERT INTO ti VALUES(]]..i..[[);]]) 3. Why do you need a space to reproduce this bug? It does not seem related.