From b3f3a4030fe3541ce85244f88f8f258a9815e1ba Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Wed, 19 Aug 2020 09:56:57 +0100 Subject: [PATCH] os/kstore: fix collection_list ordering It has the same key escaping bug as the blustore has, but we don't need to workaround it here because kstore is not in production use. Signed-off-by: Mykola Golub (cherry picked from commit c1eff9f7812b131c10df245ae92450d70623de2b) --- src/os/kstore/KStore.cc | 4 ++-- src/test/objectstore/store_test.cc | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 2cf82e5efd0fa..21d2f890c0ef6 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -89,10 +89,10 @@ static void append_escaped(const string &in, string *out) { char hexbyte[8]; for (string::const_iterator i = in.begin(); i != in.end(); ++i) { - if (*i <= '#') { + if ((unsigned char)*i <= '#') { snprintf(hexbyte, sizeof(hexbyte), "#%02x", (uint8_t)*i); out->append(hexbyte); - } else if (*i >= '~') { + } else if ((unsigned char)*i >= '~') { snprintf(hexbyte, sizeof(hexbyte), "~%02x", (uint8_t)*i); out->append(hexbyte); } else { diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index ec34d66b186a1..0b11913847aa8 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -4912,9 +4912,6 @@ TEST_P(StoreTest, HashCollisionTest) { } TEST_P(StoreTest, HashCollisionSorting) { - if (string(GetParam()) == "kstore") // TODO: fix kstore - return; - char buf121664318_1[] = {18, -119, -121, -111, 0}; char buf121664318_2[] = {19, 127, -121, 32, 0}; char buf121664318_3[] = {19, -118, 15, 19, 0}; -- 2.39.5