From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: fix error on copy empty string in mem_copy() Date: Thu, 26 Aug 2021 22:21:01 +0200 [thread overview] Message-ID: <40a89d61-e252-731c-d419-6c162eecefb4@tarantool.org> (raw) In-Reply-To: <7c4620245d61624883115541490cd94d10626c00.1629976113.git.imeevma@gmail.com> 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.
next prev parent reply other threads:[~2021-08-26 20:21 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-26 11:09 Mergen Imeev via Tarantool-patches 2021-08-26 20:21 ` Vladislav Shpilevoy via Tarantool-patches [this message] 2021-08-27 15:22 ` Mergen Imeev via Tarantool-patches 2021-08-27 21:44 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-30 5:57 ` Mergen Imeev via Tarantool-patches 2021-08-30 21:32 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-31 8:55 ` Mergen Imeev via Tarantool-patches 2021-09-01 21:34 ` Vladislav Shpilevoy via Tarantool-patches 2021-09-02 8:43 Mergen Imeev via Tarantool-patches 2021-09-02 9:15 ` Timur Safin via Tarantool-patches 2021-09-02 9:35 ` Mergen Imeev via Tarantool-patches 2021-09-02 9:17 ` Timur Safin via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=40a89d61-e252-731c-d419-6c162eecefb4@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 1/1] sql: fix error on copy empty string in mem_copy()' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox