From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 1/1] fiber: extend name buffer on 1 byte for \0
Date: Sun, 24 Feb 2019 13:58:22 +0300 [thread overview]
Message-ID: <08ce04d1843cfd15d255608d8ec7eaf70f804e9e.1551005861.git.v.shpilevoy@tarantool.org> (raw)
Checks for fiber_name legth worked with FIBER_NAME_MAX,
while one byte in fact was occupied by terminating zero.
Closes #4011
---
Issue: https://github.com/tarantool/tarantool/issues/4011
src/fiber.h | 2 +-
test/app/fiber.result | 8 ++++----
test/app/fiber.test.lua | 2 +-
test/unit/fiber.result | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/fiber.h b/src/fiber.h
index d4ed1193a..db58f320b 100644
--- a/src/fiber.h
+++ b/src/fiber.h
@@ -417,7 +417,7 @@ struct fiber {
struct ipc_wait_pad *wait_pad;
/** Exception which caused this fiber's death. */
struct diag diag;
- char name[FIBER_NAME_MAX];
+ char name[FIBER_NAME_MAX + 1];
};
enum { FIBER_CALL_STACK = 16 };
diff --git a/test/app/fiber.result b/test/app/fiber.result
index 1b72ed5da..1649d59bd 100644
--- a/test/app/fiber.result
+++ b/test/app/fiber.result
@@ -1186,7 +1186,7 @@ fiber = nil
---
...
--
--- gh-2622 fiber.name() truncates new name
+-- gh-2622, gh-4011: fiber.name() truncates new name.
--
fiber = require('fiber')
---
@@ -1214,14 +1214,14 @@ fiber.name(long_name, {truncate = true})
...
fiber.name()
---
-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
f = fiber.self()
---
...
fiber.name(f)
---
-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
fiber.name(f, 'new_name')
---
@@ -1239,7 +1239,7 @@ fiber.name(f, long_name, {truncate = true})
...
fiber.name(f)
---
-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
--
-- gh-3493 fiber.create() does not roll back memtx transaction
diff --git a/test/app/fiber.test.lua b/test/app/fiber.test.lua
index a0d1e993b..ee22087bd 100644
--- a/test/app/fiber.test.lua
+++ b/test/app/fiber.test.lua
@@ -504,7 +504,7 @@ test_run:cmd("setopt delimiter ''");
fiber = nil
--
--- gh-2622 fiber.name() truncates new name
+-- gh-2622, gh-4011: fiber.name() truncates new name.
--
fiber = require('fiber')
long_name = string.rep('a', 300)
diff --git a/test/unit/fiber.result b/test/unit/fiber.result
index 4f7108ffc..1f9773a52 100644
--- a/test/unit/fiber.result
+++ b/test/unit/fiber.result
@@ -5,7 +5,7 @@ SystemError Failed to allocate 42 bytes in allocator for exception: Cannot alloc
# set new fiber name: Horace.
-# fiber name is truncated: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
+# fiber name is truncated: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
*** fiber_name_test: done ***
*** fiber_join_test ***
--
2.17.2 (Apple Git-113)
next reply other threads:[~2019-02-24 10:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-24 10:58 Vladislav Shpilevoy [this message]
2019-02-24 11:07 ` [tarantool-patches] " Vladislav Shpilevoy
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=08ce04d1843cfd15d255608d8ec7eaf70f804e9e.1551005861.git.v.shpilevoy@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH 1/1] fiber: extend name buffer on 1 byte for \0' \
/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