* [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
@ 2021-09-06 8:11 Mergen Imeev via Tarantool-patches
2021-09-07 21:59 ` Vladislav Shpilevoy via Tarantool-patches
2021-10-05 12:13 ` Kirill Yukhin via Tarantool-patches
0 siblings, 2 replies; 12+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-09-06 8:11 UTC (permalink / raw)
To: v.shpilevoy; +Cc: tarantool-patches
Prior to this patch, an assertion was throwed if a tuple with an
incorrect id was inserted into the _priv system space. This bug
appeared only in the debug build.
Closes #6295
---
https://github.com/tarantool/tarantool/issues/6295
https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
src/box/alter.cc | 2 +
src/box/schema.cc | 47 ++++++++++++-------
.../gh-6295-assert-on-wrong-id.test.lua | 34 ++++++++++++++
test/box-tap/suite.ini | 2 +-
4 files changed, 68 insertions(+), 17 deletions(-)
create mode 100755 test/box-tap/gh-6295-assert-on-wrong-id.test.lua
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 3bd56feb9..e87fbb847 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
return -1;
}
const char *name = schema_find_name(priv->object_type, priv->object_id);
+ if (name == NULL)
+ return -1;
if (access_check_ddl(name, priv->object_id, grantor->def->uid,
priv->object_type, priv_type) != 0)
return -1;
diff --git a/src/box/schema.cc b/src/box/schema.cc
index 1970871cc..cf1e531e3 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -701,36 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
case SC_SPACE:
{
struct space *space = space_by_id(object_id);
- if (space == NULL)
- break;
- return space->def->name;
+ if (space != NULL)
+ return space->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SPACE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_FUNCTION:
{
struct func *func = func_by_id(object_id);
- if (func == NULL)
- break;
- return func->def->name;
+ if (func != NULL)
+ return func->def->name;
+ diag_set(ClientError, ER_NO_SUCH_FUNCTION,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_SEQUENCE:
{
struct sequence *seq = sequence_by_id(object_id);
- if (seq == NULL)
- break;
- return seq->def->name;
+ if (seq != NULL)
+ return seq->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_ROLE:
- case SC_USER:
{
struct user *role = user_by_id(object_id);
- if (role == NULL)
- break;
- return role->def->name;
+ if (role != NULL)
+ return role->def->name;
+ diag_set(ClientError, ER_NO_SUCH_ROLE,
+ tt_sprintf("%d", object_id));
+ break;
+ }
+ case SC_USER:
+ {
+ struct user *user = user_by_id(object_id);
+ if (user != NULL)
+ return user->def->name;
+ diag_set(ClientError, ER_NO_SUCH_USER,
+ tt_sprintf("%d", object_id));
+ break;
}
default:
- break;
+ unreachable();
}
- assert(false);
- return "(nil)";
+ return NULL;
}
diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
new file mode 100755
index 000000000..e4822f395
--- /dev/null
+++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
@@ -0,0 +1,34 @@
+#!/usr/bin/env tarantool
+
+local tap = require('tap')
+local test = tap.test('gh-6295-assert-on-wrong-id')
+
+test:plan(5)
+
+local ok, res
+
+box.cfg{}
+
+-- Should be an error, not an assertion.
+local _priv = box.space._priv
+local errmsg = "Function '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
+
+errmsg = "Sequence '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
+
+errmsg = "Space '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
+
+errmsg = "User '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
+
+errmsg = "Role '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
+
+os.exit(test:check() and 0 or 1)
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index b09d7db4f..fd55d5d24 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -3,7 +3,7 @@ core = app
description = Database tests with #! using TAP
is_parallel = True
use_unix_sockets_iproto = True
-release_disabled = errinj_set_with_enviroment_vars.test.lua
+release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
config = suite.cfg
fragile = {
"retries": 10,
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-06 8:11 [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv Mergen Imeev via Tarantool-patches
@ 2021-09-07 21:59 ` Vladislav Shpilevoy via Tarantool-patches
2021-09-09 11:07 ` Mergen Imeev via Tarantool-patches
2021-10-05 12:13 ` Kirill Yukhin via Tarantool-patches
1 sibling, 1 reply; 12+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-09-07 21:59 UTC (permalink / raw)
To: imeevma; +Cc: tarantool-patches
Hi! Thanks for the patch!
See 4 comments below.
On 06.09.2021 10:11, imeevma@tarantool.org wrote:
> Prior to this patch, an assertion was throwed if a tuple with an
1. throwed -> thrown.
> incorrect id was inserted into the _priv system space. This bug
> appeared only in the debug build.
>
> Closes #6295
> ---
> https://github.com/tarantool/tarantool/issues/6295
> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
2. Could you please add a changelog?
> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> new file mode 100755
> index 000000000..e4822f395
> --- /dev/null
> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> @@ -0,0 +1,34 @@
> +#!/usr/bin/env tarantool
> +
> +local tap = require('tap')
> +local test = tap.test('gh-6295-assert-on-wrong-id')
> +
> +test:plan(5)
> +
> +local ok, res
> +
> +box.cfg{}
> +
> +-- Should be an error, not an assertion.
> +local _priv = box.space._priv
> +local errmsg = "Function '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
3. Shouldn't the message be like a comment? Describing the correct
behaviour. It is printed always along with ok/no ok in the tap output.
So it should be about what is expected.
> diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
> index b09d7db4f..fd55d5d24 100644
> --- a/test/box-tap/suite.ini
> +++ b/test/box-tap/suite.ini
> @@ -3,7 +3,7 @@ core = app
> description = Database tests with #! using TAP
> is_parallel = True
> use_unix_sockets_iproto = True
> -release_disabled = errinj_set_with_enviroment_vars.test.lua
> +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
4. Why? The test does not pass in release?
> config = suite.cfg
> fragile = {
> "retries": 10,
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-07 21:59 ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-09-09 11:07 ` Mergen Imeev via Tarantool-patches
2021-09-27 6:41 ` Mergen Imeev via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-09-09 11:07 UTC (permalink / raw)
To: Vladislav Shpilevoy; +Cc: tarantool-patches
Hi! Thank you for the review! My answers, diff and new patch below.
On Tue, Sep 07, 2021 at 11:59:58PM +0200, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
> See 4 comments below.
>
> On 06.09.2021 10:11, imeevma@tarantool.org wrote:
> > Prior to this patch, an assertion was throwed if a tuple with an
>
> 1. throwed -> thrown.
>
Fixed.
> > incorrect id was inserted into the _priv system space. This bug
> > appeared only in the debug build.
> >
> > Closes #6295
> > ---
> > https://github.com/tarantool/tarantool/issues/6295
> > https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
>
> 2. Could you please add a changelog?
>
Added.
> > diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> > new file mode 100755
> > index 000000000..e4822f395
> > --- /dev/null
> > +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> > @@ -0,0 +1,34 @@
> > +#!/usr/bin/env tarantool
> > +
> > +local tap = require('tap')
> > +local test = tap.test('gh-6295-assert-on-wrong-id')
> > +
> > +test:plan(5)
> > +
> > +local ok, res
> > +
> > +box.cfg{}
> > +
> > +-- Should be an error, not an assertion.
> > +local _priv = box.space._priv
> > +local errmsg = "Function '1000000' does not exist"
> > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
>
> 3. Shouldn't the message be like a comment? Describing the correct
> behaviour. It is printed always along with ok/no ok in the tap output.
> So it should be about what is expected.
>
Thanks, fixed.
> > diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
> > index b09d7db4f..fd55d5d24 100644
> > --- a/test/box-tap/suite.ini
> > +++ b/test/box-tap/suite.ini
> > @@ -3,7 +3,7 @@ core = app
> > description = Database tests with #! using TAP
> > is_parallel = True
> > use_unix_sockets_iproto = True
> > -release_disabled = errinj_set_with_enviroment_vars.test.lua
> > +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
>
> 4. Why? The test does not pass in release?
>
It does, however in release build nothing will change. At least at the first
glance.
> > config = suite.cfg
> > fragile = {
> > "retries": 10,
> >
Diff:
diff --git a/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
new file mode 100644
index 000000000..058d218d7
--- /dev/null
+++ b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
@@ -0,0 +1,5 @@
+## bugfix/sql
+
+* Now inserting a tuple with the wrong "id" field into the \_priv space will
+ return the correct error (gh-6295).
+
diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
index e4822f395..add2df429 100755
--- a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
+++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
@@ -13,22 +13,22 @@ box.cfg{}
local _priv = box.space._priv
local errmsg = "Function '1000000' does not exist"
ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
-test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
errmsg = "Sequence '1000000' does not exist"
ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
-test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
errmsg = "Space '1000000' does not exist"
ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
-test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
errmsg = "User '1000000' is not found"
ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
-test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
errmsg = "Role '1000000' is not found"
ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
-test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
os.exit(test:check() and 0 or 1)
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index fd55d5d24..b09d7db4f 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -3,7 +3,7 @@ core = app
description = Database tests with #! using TAP
is_parallel = True
use_unix_sockets_iproto = True
-release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
+release_disabled = errinj_set_with_enviroment_vars.test.lua
config = suite.cfg
fragile = {
"retries": 10,
New patch:
commit a3542e0082c480f166796281d3996f6edfffcaf7
Author: Mergen Imeev <imeevma@gmail.com>
Date: Sat Aug 7 13:11:12 2021 +0300
schema: remove assert on wrong insert into _priv
Prior to this patch, an assertion was thrown if a tuple with an invalid
id was inserted into the _priv system space. This bug appeared only in
the debug build.
Closes #6295
diff --git a/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
new file mode 100644
index 000000000..058d218d7
--- /dev/null
+++ b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
@@ -0,0 +1,5 @@
+## bugfix/sql
+
+* Now inserting a tuple with the wrong "id" field into the \_priv space will
+ return the correct error (gh-6295).
+
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 3bd56feb9..e87fbb847 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
return -1;
}
const char *name = schema_find_name(priv->object_type, priv->object_id);
+ if (name == NULL)
+ return -1;
if (access_check_ddl(name, priv->object_id, grantor->def->uid,
priv->object_type, priv_type) != 0)
return -1;
diff --git a/src/box/schema.cc b/src/box/schema.cc
index 1970871cc..cf1e531e3 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -701,36 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
case SC_SPACE:
{
struct space *space = space_by_id(object_id);
- if (space == NULL)
- break;
- return space->def->name;
+ if (space != NULL)
+ return space->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SPACE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_FUNCTION:
{
struct func *func = func_by_id(object_id);
- if (func == NULL)
- break;
- return func->def->name;
+ if (func != NULL)
+ return func->def->name;
+ diag_set(ClientError, ER_NO_SUCH_FUNCTION,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_SEQUENCE:
{
struct sequence *seq = sequence_by_id(object_id);
- if (seq == NULL)
- break;
- return seq->def->name;
+ if (seq != NULL)
+ return seq->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_ROLE:
- case SC_USER:
{
struct user *role = user_by_id(object_id);
- if (role == NULL)
- break;
- return role->def->name;
+ if (role != NULL)
+ return role->def->name;
+ diag_set(ClientError, ER_NO_SUCH_ROLE,
+ tt_sprintf("%d", object_id));
+ break;
+ }
+ case SC_USER:
+ {
+ struct user *user = user_by_id(object_id);
+ if (user != NULL)
+ return user->def->name;
+ diag_set(ClientError, ER_NO_SUCH_USER,
+ tt_sprintf("%d", object_id));
+ break;
}
default:
- break;
+ unreachable();
}
- assert(false);
- return "(nil)";
+ return NULL;
}
diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
new file mode 100755
index 000000000..add2df429
--- /dev/null
+++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
@@ -0,0 +1,34 @@
+#!/usr/bin/env tarantool
+
+local tap = require('tap')
+local test = tap.test('gh-6295-assert-on-wrong-id')
+
+test:plan(5)
+
+local ok, res
+
+box.cfg{}
+
+-- Should be an error, not an assertion.
+local _priv = box.space._priv
+local errmsg = "Function '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
+
+errmsg = "Sequence '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
+
+errmsg = "Space '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
+
+errmsg = "User '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
+
+errmsg = "Role '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
+
+os.exit(test:check() and 0 or 1)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-09 11:07 ` Mergen Imeev via Tarantool-patches
@ 2021-09-27 6:41 ` Mergen Imeev via Tarantool-patches
2021-09-27 22:33 ` Vladislav Shpilevoy via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-09-27 6:41 UTC (permalink / raw)
To: Vladislav Shpilevoy; +Cc: tarantool-patches
Hi!
On 09.09.2021 14:07, Mergen Imeev wrote:
> Hi! Thank you for the review! My answers, diff and new patch below.
>
> On Tue, Sep 07, 2021 at 11:59:58PM +0200, Vladislav Shpilevoy wrote:
>> Hi! Thanks for the patch!
>>
>> See 4 comments below.
>>
>> On 06.09.2021 10:11, imeevma@tarantool.org wrote:
>>> Prior to this patch, an assertion was throwed if a tuple with an
>> 1. throwed -> thrown.
>>
> Fixed.
>
>>> incorrect id was inserted into the _priv system space. This bug
>>> appeared only in the debug build.
>>>
>>> Closes #6295
>>> ---
>>> https://github.com/tarantool/tarantool/issues/6295
>>> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
>> 2. Could you please add a changelog?
>>
> Added.
>
>>> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
>>> new file mode 100755
>>> index 000000000..e4822f395
>>> --- /dev/null
>>> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
>>> @@ -0,0 +1,34 @@
>>> +#!/usr/bin/env tarantool
>>> +
>>> +local tap = require('tap')
>>> +local test = tap.test('gh-6295-assert-on-wrong-id')
>>> +
>>> +test:plan(5)
>>> +
>>> +local ok, res
>>> +
>>> +box.cfg{}
>>> +
>>> +-- Should be an error, not an assertion.
>>> +local _priv = box.space._priv
>>> +local errmsg = "Function '1000000' does not exist"
>>> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
>>> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
>> 3. Shouldn't the message be like a comment? Describing the correct
>> behaviour. It is printed always along with ok/no ok in the tap output.
>> So it should be about what is expected.
>>
> Thanks, fixed.
>
>>> diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
>>> index b09d7db4f..fd55d5d24 100644
>>> --- a/test/box-tap/suite.ini
>>> +++ b/test/box-tap/suite.ini
>>> @@ -3,7 +3,7 @@ core = app
>>> description = Database tests with #! using TAP
>>> is_parallel = True
>>> use_unix_sockets_iproto = True
>>> -release_disabled = errinj_set_with_enviroment_vars.test.lua
>>> +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
>> 4. Why? The test does not pass in release?
>>
> It does, however in release build nothing will change. At least at the first
> glance.
>
>>> config = suite.cfg
>>> fragile = {
>>> "retries": 10,
>>>
>
> Diff:
>
>
> diff --git a/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
> new file mode 100644
> index 000000000..058d218d7
> --- /dev/null
> +++ b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
> @@ -0,0 +1,5 @@
> +## bugfix/sql
> +
> +* Now inserting a tuple with the wrong "id" field into the \_priv space will
> + return the correct error (gh-6295).
> +
> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> index e4822f395..add2df429 100755
> --- a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> @@ -13,22 +13,22 @@ box.cfg{}
> local _priv = box.space._priv
> local errmsg = "Function '1000000' does not exist"
> ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> -test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
>
> errmsg = "Sequence '1000000' does not exist"
> ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
> -test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
>
> errmsg = "Space '1000000' does not exist"
> ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
> -test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
>
> errmsg = "User '1000000' is not found"
> ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
> -test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
>
> errmsg = "Role '1000000' is not found"
> ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
> -test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
>
> os.exit(test:check() and 0 or 1)
> diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
> index fd55d5d24..b09d7db4f 100644
> --- a/test/box-tap/suite.ini
> +++ b/test/box-tap/suite.ini
> @@ -3,7 +3,7 @@ core = app
> description = Database tests with #! using TAP
> is_parallel = True
> use_unix_sockets_iproto = True
> -release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
> +release_disabled = errinj_set_with_enviroment_vars.test.lua
> config = suite.cfg
> fragile = {
> "retries": 10,
>
>
> New patch:
>
>
> commit a3542e0082c480f166796281d3996f6edfffcaf7
> Author: Mergen Imeev <imeevma@gmail.com>
> Date: Sat Aug 7 13:11:12 2021 +0300
>
> schema: remove assert on wrong insert into _priv
>
> Prior to this patch, an assertion was thrown if a tuple with an invalid
> id was inserted into the _priv system space. This bug appeared only in
> the debug build.
>
> Closes #6295
>
> diff --git a/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
> new file mode 100644
> index 000000000..058d218d7
> --- /dev/null
> +++ b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
> @@ -0,0 +1,5 @@
> +## bugfix/sql
> +
> +* Now inserting a tuple with the wrong "id" field into the \_priv space will
> + return the correct error (gh-6295).
> +
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index 3bd56feb9..e87fbb847 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
> return -1;
> }
> const char *name = schema_find_name(priv->object_type, priv->object_id);
> + if (name == NULL)
> + return -1;
> if (access_check_ddl(name, priv->object_id, grantor->def->uid,
> priv->object_type, priv_type) != 0)
> return -1;
> diff --git a/src/box/schema.cc b/src/box/schema.cc
> index 1970871cc..cf1e531e3 100644
> --- a/src/box/schema.cc
> +++ b/src/box/schema.cc
> @@ -701,36 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
> case SC_SPACE:
> {
> struct space *space = space_by_id(object_id);
> - if (space == NULL)
> - break;
> - return space->def->name;
> + if (space != NULL)
> + return space->def->name;
> + diag_set(ClientError, ER_NO_SUCH_SPACE,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_FUNCTION:
> {
> struct func *func = func_by_id(object_id);
> - if (func == NULL)
> - break;
> - return func->def->name;
> + if (func != NULL)
> + return func->def->name;
> + diag_set(ClientError, ER_NO_SUCH_FUNCTION,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_SEQUENCE:
> {
> struct sequence *seq = sequence_by_id(object_id);
> - if (seq == NULL)
> - break;
> - return seq->def->name;
> + if (seq != NULL)
> + return seq->def->name;
> + diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_ROLE:
> - case SC_USER:
> {
> struct user *role = user_by_id(object_id);
> - if (role == NULL)
> - break;
> - return role->def->name;
> + if (role != NULL)
> + return role->def->name;
> + diag_set(ClientError, ER_NO_SUCH_ROLE,
> + tt_sprintf("%d", object_id));
> + break;
> + }
> + case SC_USER:
> + {
> + struct user *user = user_by_id(object_id);
> + if (user != NULL)
> + return user->def->name;
> + diag_set(ClientError, ER_NO_SUCH_USER,
> + tt_sprintf("%d", object_id));
> + break;
> }
> default:
> - break;
> + unreachable();
> }
> - assert(false);
> - return "(nil)";
> + return NULL;
> }
>
> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> new file mode 100755
> index 000000000..add2df429
> --- /dev/null
> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> @@ -0,0 +1,34 @@
> +#!/usr/bin/env tarantool
> +
> +local tap = require('tap')
> +local test = tap.test('gh-6295-assert-on-wrong-id')
> +
> +test:plan(5)
> +
> +local ok, res
> +
> +box.cfg{}
> +
> +-- Should be an error, not an assertion.
> +local _priv = box.space._priv
> +local errmsg = "Function '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
> +
> +errmsg = "Sequence '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
> +
> +errmsg = "Space '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
> +
> +errmsg = "User '1000000' is not found"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
> +
> +errmsg = "Role '1000000' is not found"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Proper error is returned")
> +
> +os.exit(test:check() and 0 or 1)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-27 6:41 ` Mergen Imeev via Tarantool-patches
@ 2021-09-27 22:33 ` Vladislav Shpilevoy via Tarantool-patches
2021-09-29 6:32 ` Mergen Imeev via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-09-27 22:33 UTC (permalink / raw)
To: Mergen Imeev; +Cc: tarantool-patches
Hi! Thanks for the fixes!
On 27.09.2021 08:41, Mergen Imeev wrote:
> Hi!
>
> On 09.09.2021 14:07, Mergen Imeev wrote:
>> Hi! Thank you for the review! My answers, diff and new patch below.
>>
>> On Tue, Sep 07, 2021 at 11:59:58PM +0200, Vladislav Shpilevoy wrote:
>>> Hi! Thanks for the patch!
>>>
>>> See 4 comments below.
>>>
>>> On 06.09.2021 10:11, imeevma@tarantool.org wrote:
>>>> Prior to this patch, an assertion was throwed if a tuple with an
>>> 1. throwed -> thrown.
>>>
>> Fixed.
I still see it on the branch.
>>>> incorrect id was inserted into the _priv system space. This bug
>>>> appeared only in the debug build.
>>>>
>>>> Closes #6295
>>>> ---
>>>> https://github.com/tarantool/tarantool/issues/6295
>>>> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
>>> 2. Could you please add a changelog?
>>>
>> Added.
Not on the branch.
Are you sure you pushed the new version?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-27 22:33 ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-09-29 6:32 ` Mergen Imeev via Tarantool-patches
2021-09-30 22:46 ` Vladislav Shpilevoy via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-09-29 6:32 UTC (permalink / raw)
To: Vladislav Shpilevoy; +Cc: tarantool-patches
Hi! I'm very sorry! I rebased and pushed:
https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
On Tue, Sep 28, 2021 at 12:33:02AM +0200, Vladislav Shpilevoy wrote:
> Hi! Thanks for the fixes!
>
> On 27.09.2021 08:41, Mergen Imeev wrote:
> > Hi!
> >
> > On 09.09.2021 14:07, Mergen Imeev wrote:
> >> Hi! Thank you for the review! My answers, diff and new patch below.
> >>
> >> On Tue, Sep 07, 2021 at 11:59:58PM +0200, Vladislav Shpilevoy wrote:
> >>> Hi! Thanks for the patch!
> >>>
> >>> See 4 comments below.
> >>>
> >>> On 06.09.2021 10:11, imeevma@tarantool.org wrote:
> >>>> Prior to this patch, an assertion was throwed if a tuple with an
> >>> 1. throwed -> thrown.
> >>>
> >> Fixed.
>
> I still see it on the branch.
>
> >>>> incorrect id was inserted into the _priv system space. This bug
> >>>> appeared only in the debug build.
> >>>>
> >>>> Closes #6295
> >>>> ---
> >>>> https://github.com/tarantool/tarantool/issues/6295
> >>>> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
> >>> 2. Could you please add a changelog?
> >>>
> >> Added.
>
> Not on the branch.
>
> Are you sure you pushed the new version?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-29 6:32 ` Mergen Imeev via Tarantool-patches
@ 2021-09-30 22:46 ` Vladislav Shpilevoy via Tarantool-patches
0 siblings, 0 replies; 12+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-09-30 22:46 UTC (permalink / raw)
To: Mergen Imeev; +Cc: tarantool-patches
Hi! Thanks for the fixes!
> diff --git a/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
> new file mode 100644
> index 000000000..058d218d7
> --- /dev/null
> +++ b/changelogs/unreleased/gh-6295-assert-on-wrong-insert-into-_priv.md
> @@ -0,0 +1,5 @@
> +## bugfix/sql
It isn't only SQL - _priv space can be used from Lua, from C.
The rest LGTM. You can send it to a next reviewer after fixing
the changelog title.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-06 8:11 [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv Mergen Imeev via Tarantool-patches
2021-09-07 21:59 ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-10-05 12:13 ` Kirill Yukhin via Tarantool-patches
1 sibling, 0 replies; 12+ messages in thread
From: Kirill Yukhin via Tarantool-patches @ 2021-10-05 12:13 UTC (permalink / raw)
To: imeevma; +Cc: v.shpilevoy, tarantool-patches
Hello,
On 06 сен 11:11, Mergen Imeev via Tarantool-patches wrote:
> Prior to this patch, an assertion was throwed if a tuple with an
> incorrect id was inserted into the _priv system space. This bug
> appeared only in the debug build.
>
> Closes #6295
> ---
> https://github.com/tarantool/tarantool/issues/6295
> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
I've checked your patch into 2.8 and master.
--
Regards, Kirill Yukhin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-09-03 6:59 ` Mergen Imeev via Tarantool-patches
@ 2021-09-06 8:05 ` Serge Petrenko via Tarantool-patches
0 siblings, 0 replies; 12+ messages in thread
From: Serge Petrenko via Tarantool-patches @ 2021-09-06 8:05 UTC (permalink / raw)
To: Mergen Imeev; +Cc: tarantool-patches
03.09.2021 09:59, Mergen Imeev пишет:
> Hi! Thank you for the review! And sorry for such late reply. My answer, diff and
> new patch below.
>
> On Tue, Aug 17, 2021 at 03:32:02PM +0300, Serge Petrenko wrote:
>>
>> 16.08.2021 19:13, imeevma@tarantool.org пишет:
>>> Prior to this patch, an assertion was throwed if a tuple with an
>>> incorrect id was inserted into the _priv system space. This bug
>>> appeared only in the debug build.
>>>
>>> Closes #6295
>>> ---
>>> https://github.com/tarantool/tarantool/issues/6295
>>> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
>>>
>>> src/box/schema.cc | 1 -
>>> .../gh-6295-assert-on-wrong-id.test.lua | 34 +++++++++++++++++++
>>> test/box-tap/suite.ini | 2 +-
>>> 3 files changed, 35 insertions(+), 2 deletions(-)
>>> create mode 100755 test/box-tap/gh-6295-assert-on-wrong-id.test.lua
>>>
>>> diff --git a/src/box/schema.cc b/src/box/schema.cc
>>> index 1970871cc..ac19a2b1e 100644
>>> --- a/src/box/schema.cc
>>> +++ b/src/box/schema.cc
>>> @@ -730,7 +730,6 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
>>> default:
>>> break;
>>> }
>>> - assert(false);
>>> return "(nil)";
>>> }
>>
>> Thanks for the patch!
>>
>> I think it's better to return NULL in this case.
>> And set the diagnostics accordingly.
>> And check for schema_find_name results in alter.cc
>>
>> schema_find_name is the place where we already know there's no such space,
>> or
>> function, and so on.
>>
>> So priv_def_check should fail right at schema_find_name, not later.
>>
> Fixed.
>
>>> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
>>> new file mode 100755
>>> index 000000000..e4822f395
>>> --- /dev/null
>>> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
>>> @@ -0,0 +1,34 @@
>>> +#!/usr/bin/env tarantool
>>> +
>>> +local tap = require('tap')
>>> +local test = tap.test('gh-6295-assert-on-wrong-id')
>>> +
>>> +test:plan(5)
>>> +
>>> +local ok, res
>>> +
>>> +box.cfg{}
>>> +
>>> +-- Should be an error, not an assertion.
>>> +local _priv = box.space._priv
>>> +local errmsg = "Function '1000000' does not exist"
>>> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
>>> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
>>> +
>>> +errmsg = "Sequence '1000000' does not exist"
>>> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
>>> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
>>> +
>>> +errmsg = "Space '1000000' does not exist"
>>> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
>>> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
>>> +
>>> +errmsg = "User '1000000' is not found"
>>> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
>>> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
>>> +
>>> +errmsg = "Role '1000000' is not found"
>>> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
>>> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
>>> +
>>> +os.exit(test:check() and 0 or 1)
>>> diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
>>> index b09d7db4f..fd55d5d24 100644
>>> --- a/test/box-tap/suite.ini
>>> +++ b/test/box-tap/suite.ini
>>> @@ -3,7 +3,7 @@ core = app
>>> description = Database tests with #! using TAP
>>> is_parallel = True
>>> use_unix_sockets_iproto = True
>>> -release_disabled = errinj_set_with_enviroment_vars.test.lua
>>> +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
>>> config = suite.cfg
>>> fragile = {
>>> "retries": 10,
>> --
>> Serge Petrenko
>>
>
> Diff:
>
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index 3bd56feb9..e87fbb847 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
> return -1;
> }
> const char *name = schema_find_name(priv->object_type, priv->object_id);
> + if (name == NULL)
> + return -1;
> if (access_check_ddl(name, priv->object_id, grantor->def->uid,
> priv->object_type, priv_type) != 0)
> return -1;
> diff --git a/src/box/schema.cc b/src/box/schema.cc
> index ac19a2b1e..cf1e531e3 100644
> --- a/src/box/schema.cc
> +++ b/src/box/schema.cc
> @@ -701,35 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
> case SC_SPACE:
> {
> struct space *space = space_by_id(object_id);
> - if (space == NULL)
> - break;
> - return space->def->name;
> + if (space != NULL)
> + return space->def->name;
> + diag_set(ClientError, ER_NO_SUCH_SPACE,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_FUNCTION:
> {
> struct func *func = func_by_id(object_id);
> - if (func == NULL)
> - break;
> - return func->def->name;
> + if (func != NULL)
> + return func->def->name;
> + diag_set(ClientError, ER_NO_SUCH_FUNCTION,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_SEQUENCE:
> {
> struct sequence *seq = sequence_by_id(object_id);
> - if (seq == NULL)
> - break;
> - return seq->def->name;
> + if (seq != NULL)
> + return seq->def->name;
> + diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_ROLE:
> - case SC_USER:
> {
> struct user *role = user_by_id(object_id);
> - if (role == NULL)
> - break;
> - return role->def->name;
> + if (role != NULL)
> + return role->def->name;
> + diag_set(ClientError, ER_NO_SUCH_ROLE,
> + tt_sprintf("%d", object_id));
> + break;
> + }
> + case SC_USER:
> + {
> + struct user *user = user_by_id(object_id);
> + if (user != NULL)
> + return user->def->name;
> + diag_set(ClientError, ER_NO_SUCH_USER,
> + tt_sprintf("%d", object_id));
> + break;
> }
> default:
> - break;
> + unreachable();
> }
> - return "(nil)";
> + return NULL;
> }
>
Thanks for the fixes!
LGTM.
> New patch:
>
>
> commit 38ac1b8d1ecae3352b8fe748def9e8a451239b9a
> Author: Mergen Imeev <imeevma@gmail.com>
> Date: Sat Aug 7 13:11:12 2021 +0300
>
> schema: remove assert on wrong insert into _priv
>
> Prior to this patch, an assertion was throwed if a tuple with an
> incorrect id was inserted into the _priv system space. This bug
> appeared only in the debug build.
>
> Closes #6295
>
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index 3bd56feb9..e87fbb847 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
> return -1;
> }
> const char *name = schema_find_name(priv->object_type, priv->object_id);
> + if (name == NULL)
> + return -1;
> if (access_check_ddl(name, priv->object_id, grantor->def->uid,
> priv->object_type, priv_type) != 0)
> return -1;
> diff --git a/src/box/schema.cc b/src/box/schema.cc
> index 1970871cc..cf1e531e3 100644
> --- a/src/box/schema.cc
> +++ b/src/box/schema.cc
> @@ -701,36 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
> case SC_SPACE:
> {
> struct space *space = space_by_id(object_id);
> - if (space == NULL)
> - break;
> - return space->def->name;
> + if (space != NULL)
> + return space->def->name;
> + diag_set(ClientError, ER_NO_SUCH_SPACE,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_FUNCTION:
> {
> struct func *func = func_by_id(object_id);
> - if (func == NULL)
> - break;
> - return func->def->name;
> + if (func != NULL)
> + return func->def->name;
> + diag_set(ClientError, ER_NO_SUCH_FUNCTION,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_SEQUENCE:
> {
> struct sequence *seq = sequence_by_id(object_id);
> - if (seq == NULL)
> - break;
> - return seq->def->name;
> + if (seq != NULL)
> + return seq->def->name;
> + diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
> + tt_sprintf("%d", object_id));
> + break;
> }
> case SC_ROLE:
> - case SC_USER:
> {
> struct user *role = user_by_id(object_id);
> - if (role == NULL)
> - break;
> - return role->def->name;
> + if (role != NULL)
> + return role->def->name;
> + diag_set(ClientError, ER_NO_SUCH_ROLE,
> + tt_sprintf("%d", object_id));
> + break;
> + }
> + case SC_USER:
> + {
> + struct user *user = user_by_id(object_id);
> + if (user != NULL)
> + return user->def->name;
> + diag_set(ClientError, ER_NO_SUCH_USER,
> + tt_sprintf("%d", object_id));
> + break;
> }
> default:
> - break;
> + unreachable();
> }
> - assert(false);
> - return "(nil)";
> + return NULL;
> }
>
> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> new file mode 100755
> index 000000000..e4822f395
> --- /dev/null
> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> @@ -0,0 +1,34 @@
> +#!/usr/bin/env tarantool
> +
> +local tap = require('tap')
> +local test = tap.test('gh-6295-assert-on-wrong-id')
> +
> +test:plan(5)
> +
> +local ok, res
> +
> +box.cfg{}
> +
> +-- Should be an error, not an assertion.
> +local _priv = box.space._priv
> +local errmsg = "Function '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
> +
> +errmsg = "Sequence '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
> +
> +errmsg = "Space '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
> +
> +errmsg = "User '1000000' is not found"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
> +
> +errmsg = "Role '1000000' is not found"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
> +
> +os.exit(test:check() and 0 or 1)
> diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
> index b09d7db4f..fd55d5d24 100644
> --- a/test/box-tap/suite.ini
> +++ b/test/box-tap/suite.ini
> @@ -3,7 +3,7 @@ core = app
> description = Database tests with #! using TAP
> is_parallel = True
> use_unix_sockets_iproto = True
> -release_disabled = errinj_set_with_enviroment_vars.test.lua
> +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
> config = suite.cfg
> fragile = {
> "retries": 10,
--
Serge Petrenko
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-08-17 12:32 ` Serge Petrenko via Tarantool-patches
@ 2021-09-03 6:59 ` Mergen Imeev via Tarantool-patches
2021-09-06 8:05 ` Serge Petrenko via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-09-03 6:59 UTC (permalink / raw)
To: Serge Petrenko; +Cc: tarantool-patches
Hi! Thank you for the review! And sorry for such late reply. My answer, diff and
new patch below.
On Tue, Aug 17, 2021 at 03:32:02PM +0300, Serge Petrenko wrote:
>
>
> 16.08.2021 19:13, imeevma@tarantool.org пишет:
> > Prior to this patch, an assertion was throwed if a tuple with an
> > incorrect id was inserted into the _priv system space. This bug
> > appeared only in the debug build.
> >
> > Closes #6295
> > ---
> > https://github.com/tarantool/tarantool/issues/6295
> > https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
> >
> > src/box/schema.cc | 1 -
> > .../gh-6295-assert-on-wrong-id.test.lua | 34 +++++++++++++++++++
> > test/box-tap/suite.ini | 2 +-
> > 3 files changed, 35 insertions(+), 2 deletions(-)
> > create mode 100755 test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> >
> > diff --git a/src/box/schema.cc b/src/box/schema.cc
> > index 1970871cc..ac19a2b1e 100644
> > --- a/src/box/schema.cc
> > +++ b/src/box/schema.cc
> > @@ -730,7 +730,6 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
> > default:
> > break;
> > }
> > - assert(false);
> > return "(nil)";
> > }
>
>
> Thanks for the patch!
>
> I think it's better to return NULL in this case.
> And set the diagnostics accordingly.
> And check for schema_find_name results in alter.cc
>
> schema_find_name is the place where we already know there's no such space,
> or
> function, and so on.
>
> So priv_def_check should fail right at schema_find_name, not later.
>
Fixed.
> > diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> > new file mode 100755
> > index 000000000..e4822f395
> > --- /dev/null
> > +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> > @@ -0,0 +1,34 @@
> > +#!/usr/bin/env tarantool
> > +
> > +local tap = require('tap')
> > +local test = tap.test('gh-6295-assert-on-wrong-id')
> > +
> > +test:plan(5)
> > +
> > +local ok, res
> > +
> > +box.cfg{}
> > +
> > +-- Should be an error, not an assertion.
> > +local _priv = box.space._priv
> > +local errmsg = "Function '1000000' does not exist"
> > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
> > +
> > +errmsg = "Sequence '1000000' does not exist"
> > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
> > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
> > +
> > +errmsg = "Space '1000000' does not exist"
> > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
> > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
> > +
> > +errmsg = "User '1000000' is not found"
> > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
> > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
> > +
> > +errmsg = "Role '1000000' is not found"
> > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
> > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
> > +
> > +os.exit(test:check() and 0 or 1)
> > diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
> > index b09d7db4f..fd55d5d24 100644
> > --- a/test/box-tap/suite.ini
> > +++ b/test/box-tap/suite.ini
> > @@ -3,7 +3,7 @@ core = app
> > description = Database tests with #! using TAP
> > is_parallel = True
> > use_unix_sockets_iproto = True
> > -release_disabled = errinj_set_with_enviroment_vars.test.lua
> > +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
> > config = suite.cfg
> > fragile = {
> > "retries": 10,
>
> --
> Serge Petrenko
>
Diff:
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 3bd56feb9..e87fbb847 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
return -1;
}
const char *name = schema_find_name(priv->object_type, priv->object_id);
+ if (name == NULL)
+ return -1;
if (access_check_ddl(name, priv->object_id, grantor->def->uid,
priv->object_type, priv_type) != 0)
return -1;
diff --git a/src/box/schema.cc b/src/box/schema.cc
index ac19a2b1e..cf1e531e3 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -701,35 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
case SC_SPACE:
{
struct space *space = space_by_id(object_id);
- if (space == NULL)
- break;
- return space->def->name;
+ if (space != NULL)
+ return space->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SPACE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_FUNCTION:
{
struct func *func = func_by_id(object_id);
- if (func == NULL)
- break;
- return func->def->name;
+ if (func != NULL)
+ return func->def->name;
+ diag_set(ClientError, ER_NO_SUCH_FUNCTION,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_SEQUENCE:
{
struct sequence *seq = sequence_by_id(object_id);
- if (seq == NULL)
- break;
- return seq->def->name;
+ if (seq != NULL)
+ return seq->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_ROLE:
- case SC_USER:
{
struct user *role = user_by_id(object_id);
- if (role == NULL)
- break;
- return role->def->name;
+ if (role != NULL)
+ return role->def->name;
+ diag_set(ClientError, ER_NO_SUCH_ROLE,
+ tt_sprintf("%d", object_id));
+ break;
+ }
+ case SC_USER:
+ {
+ struct user *user = user_by_id(object_id);
+ if (user != NULL)
+ return user->def->name;
+ diag_set(ClientError, ER_NO_SUCH_USER,
+ tt_sprintf("%d", object_id));
+ break;
}
default:
- break;
+ unreachable();
}
- return "(nil)";
+ return NULL;
}
New patch:
commit 38ac1b8d1ecae3352b8fe748def9e8a451239b9a
Author: Mergen Imeev <imeevma@gmail.com>
Date: Sat Aug 7 13:11:12 2021 +0300
schema: remove assert on wrong insert into _priv
Prior to this patch, an assertion was throwed if a tuple with an
incorrect id was inserted into the _priv system space. This bug
appeared only in the debug build.
Closes #6295
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 3bd56feb9..e87fbb847 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -3954,6 +3954,8 @@ priv_def_check(struct priv_def *priv, enum priv_type priv_type)
return -1;
}
const char *name = schema_find_name(priv->object_type, priv->object_id);
+ if (name == NULL)
+ return -1;
if (access_check_ddl(name, priv->object_id, grantor->def->uid,
priv->object_type, priv_type) != 0)
return -1;
diff --git a/src/box/schema.cc b/src/box/schema.cc
index 1970871cc..cf1e531e3 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -701,36 +701,51 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
case SC_SPACE:
{
struct space *space = space_by_id(object_id);
- if (space == NULL)
- break;
- return space->def->name;
+ if (space != NULL)
+ return space->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SPACE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_FUNCTION:
{
struct func *func = func_by_id(object_id);
- if (func == NULL)
- break;
- return func->def->name;
+ if (func != NULL)
+ return func->def->name;
+ diag_set(ClientError, ER_NO_SUCH_FUNCTION,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_SEQUENCE:
{
struct sequence *seq = sequence_by_id(object_id);
- if (seq == NULL)
- break;
- return seq->def->name;
+ if (seq != NULL)
+ return seq->def->name;
+ diag_set(ClientError, ER_NO_SUCH_SEQUENCE,
+ tt_sprintf("%d", object_id));
+ break;
}
case SC_ROLE:
- case SC_USER:
{
struct user *role = user_by_id(object_id);
- if (role == NULL)
- break;
- return role->def->name;
+ if (role != NULL)
+ return role->def->name;
+ diag_set(ClientError, ER_NO_SUCH_ROLE,
+ tt_sprintf("%d", object_id));
+ break;
+ }
+ case SC_USER:
+ {
+ struct user *user = user_by_id(object_id);
+ if (user != NULL)
+ return user->def->name;
+ diag_set(ClientError, ER_NO_SUCH_USER,
+ tt_sprintf("%d", object_id));
+ break;
}
default:
- break;
+ unreachable();
}
- assert(false);
- return "(nil)";
+ return NULL;
}
diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
new file mode 100755
index 000000000..e4822f395
--- /dev/null
+++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
@@ -0,0 +1,34 @@
+#!/usr/bin/env tarantool
+
+local tap = require('tap')
+local test = tap.test('gh-6295-assert-on-wrong-id')
+
+test:plan(5)
+
+local ok, res
+
+box.cfg{}
+
+-- Should be an error, not an assertion.
+local _priv = box.space._priv
+local errmsg = "Function '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
+
+errmsg = "Sequence '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
+
+errmsg = "Space '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
+
+errmsg = "User '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
+
+errmsg = "Role '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
+
+os.exit(test:check() and 0 or 1)
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index b09d7db4f..fd55d5d24 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -3,7 +3,7 @@ core = app
description = Database tests with #! using TAP
is_parallel = True
use_unix_sockets_iproto = True
-release_disabled = errinj_set_with_enviroment_vars.test.lua
+release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
config = suite.cfg
fragile = {
"retries": 10,
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
2021-08-16 16:13 Mergen Imeev via Tarantool-patches
@ 2021-08-17 12:32 ` Serge Petrenko via Tarantool-patches
2021-09-03 6:59 ` Mergen Imeev via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Serge Petrenko via Tarantool-patches @ 2021-08-17 12:32 UTC (permalink / raw)
To: imeevma; +Cc: tarantool-patches
16.08.2021 19:13, imeevma@tarantool.org пишет:
> Prior to this patch, an assertion was throwed if a tuple with an
> incorrect id was inserted into the _priv system space. This bug
> appeared only in the debug build.
>
> Closes #6295
> ---
> https://github.com/tarantool/tarantool/issues/6295
> https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
>
> src/box/schema.cc | 1 -
> .../gh-6295-assert-on-wrong-id.test.lua | 34 +++++++++++++++++++
> test/box-tap/suite.ini | 2 +-
> 3 files changed, 35 insertions(+), 2 deletions(-)
> create mode 100755 test/box-tap/gh-6295-assert-on-wrong-id.test.lua
>
> diff --git a/src/box/schema.cc b/src/box/schema.cc
> index 1970871cc..ac19a2b1e 100644
> --- a/src/box/schema.cc
> +++ b/src/box/schema.cc
> @@ -730,7 +730,6 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
> default:
> break;
> }
> - assert(false);
> return "(nil)";
> }
Thanks for the patch!
I think it's better to return NULL in this case.
And set the diagnostics accordingly.
And check for schema_find_name results in alter.cc
schema_find_name is the place where we already know there's no such
space, or
function, and so on.
So priv_def_check should fail right at schema_find_name, not later.
> diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> new file mode 100755
> index 000000000..e4822f395
> --- /dev/null
> +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
> @@ -0,0 +1,34 @@
> +#!/usr/bin/env tarantool
> +
> +local tap = require('tap')
> +local test = tap.test('gh-6295-assert-on-wrong-id')
> +
> +test:plan(5)
> +
> +local ok, res
> +
> +box.cfg{}
> +
> +-- Should be an error, not an assertion.
> +local _priv = box.space._priv
> +local errmsg = "Function '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
> +
> +errmsg = "Sequence '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
> +
> +errmsg = "Space '1000000' does not exist"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
> +
> +errmsg = "User '1000000' is not found"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
> +
> +errmsg = "Role '1000000' is not found"
> +ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
> +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
> +
> +os.exit(test:check() and 0 or 1)
> diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
> index b09d7db4f..fd55d5d24 100644
> --- a/test/box-tap/suite.ini
> +++ b/test/box-tap/suite.ini
> @@ -3,7 +3,7 @@ core = app
> description = Database tests with #! using TAP
> is_parallel = True
> use_unix_sockets_iproto = True
> -release_disabled = errinj_set_with_enviroment_vars.test.lua
> +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
> config = suite.cfg
> fragile = {
> "retries": 10,
--
Serge Petrenko
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv
@ 2021-08-16 16:13 Mergen Imeev via Tarantool-patches
2021-08-17 12:32 ` Serge Petrenko via Tarantool-patches
0 siblings, 1 reply; 12+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-08-16 16:13 UTC (permalink / raw)
To: sergepetrenko; +Cc: tarantool-patches
Prior to this patch, an assertion was throwed if a tuple with an
incorrect id was inserted into the _priv system space. This bug
appeared only in the debug build.
Closes #6295
---
https://github.com/tarantool/tarantool/issues/6295
https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id
src/box/schema.cc | 1 -
.../gh-6295-assert-on-wrong-id.test.lua | 34 +++++++++++++++++++
test/box-tap/suite.ini | 2 +-
3 files changed, 35 insertions(+), 2 deletions(-)
create mode 100755 test/box-tap/gh-6295-assert-on-wrong-id.test.lua
diff --git a/src/box/schema.cc b/src/box/schema.cc
index 1970871cc..ac19a2b1e 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -730,7 +730,6 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
default:
break;
}
- assert(false);
return "(nil)";
}
diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
new file mode 100755
index 000000000..e4822f395
--- /dev/null
+++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua
@@ -0,0 +1,34 @@
+#!/usr/bin/env tarantool
+
+local tap = require('tap')
+local test = tap.test('gh-6295-assert-on-wrong-id')
+
+test:plan(5)
+
+local ok, res
+
+box.cfg{}
+
+-- Should be an error, not an assertion.
+local _priv = box.space._priv
+local errmsg = "Function '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists")
+
+errmsg = "Sequence '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists")
+
+errmsg = "Space '1000000' does not exist"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists")
+
+errmsg = "User '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists")
+
+errmsg = "Role '1000000' is not found"
+ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A})
+test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists")
+
+os.exit(test:check() and 0 or 1)
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index b09d7db4f..fd55d5d24 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -3,7 +3,7 @@ core = app
description = Database tests with #! using TAP
is_parallel = True
use_unix_sockets_iproto = True
-release_disabled = errinj_set_with_enviroment_vars.test.lua
+release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua
config = suite.cfg
fragile = {
"retries": 10,
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-10-05 12:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 8:11 [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv Mergen Imeev via Tarantool-patches
2021-09-07 21:59 ` Vladislav Shpilevoy via Tarantool-patches
2021-09-09 11:07 ` Mergen Imeev via Tarantool-patches
2021-09-27 6:41 ` Mergen Imeev via Tarantool-patches
2021-09-27 22:33 ` Vladislav Shpilevoy via Tarantool-patches
2021-09-29 6:32 ` Mergen Imeev via Tarantool-patches
2021-09-30 22:46 ` Vladislav Shpilevoy via Tarantool-patches
2021-10-05 12:13 ` Kirill Yukhin via Tarantool-patches
-- strict thread matches above, loose matches on Subject: below --
2021-08-16 16:13 Mergen Imeev via Tarantool-patches
2021-08-17 12:32 ` Serge Petrenko via Tarantool-patches
2021-09-03 6:59 ` Mergen Imeev via Tarantool-patches
2021-09-06 8:05 ` Serge Petrenko via Tarantool-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox