mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
Merge pull request #11502 from liewegas/wip-bluestore-keybug
os/bluestore: fix escaping of chars > 0x80 Reviewed-by: Igor Fedotov <ifedotov@mirantis.com>
This commit is contained in:
commit
78e262afd5
@ -114,10 +114,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 <= '#') {
|
||||
snprintf(hexbyte, sizeof(hexbyte), "#%02x", (unsigned)*i);
|
||||
snprintf(hexbyte, sizeof(hexbyte), "#%02x", (uint8_t)*i);
|
||||
out->append(hexbyte);
|
||||
} else if (*i >= '~') {
|
||||
snprintf(hexbyte, sizeof(hexbyte), "~%02x", (unsigned)*i);
|
||||
snprintf(hexbyte, sizeof(hexbyte), "~%02x", (uint8_t)*i);
|
||||
out->append(hexbyte);
|
||||
} else {
|
||||
out->push_back(*i);
|
||||
|
@ -84,10 +84,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 <= '#') {
|
||||
snprintf(hexbyte, sizeof(hexbyte), "#%02x", (unsigned)*i);
|
||||
snprintf(hexbyte, sizeof(hexbyte), "#%02x", (uint8_t)*i);
|
||||
out->append(hexbyte);
|
||||
} else if (*i >= '~') {
|
||||
snprintf(hexbyte, sizeof(hexbyte), "~%02x", (unsigned)*i);
|
||||
snprintf(hexbyte, sizeof(hexbyte), "~%02x", (uint8_t)*i);
|
||||
out->append(hexbyte);
|
||||
} else {
|
||||
out->push_back(*i);
|
||||
|
@ -229,6 +229,37 @@ TEST_P(StoreTest, IORemount) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(StoreTest, UnprintableCharsName) {
|
||||
ObjectStore::Sequencer osr("test");
|
||||
coll_t cid;
|
||||
string name = "funnychars_";
|
||||
for (unsigned i = 0; i < 256; ++i) {
|
||||
name.push_back(i);
|
||||
}
|
||||
ghobject_t oid(hobject_t(sobject_t(name, CEPH_NOSNAP)));
|
||||
int r;
|
||||
{
|
||||
cerr << "create collection + object" << std::endl;
|
||||
ObjectStore::Transaction t;
|
||||
t.create_collection(cid, 0);
|
||||
t.touch(cid, oid);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
r = store->umount();
|
||||
ASSERT_EQ(0, r);
|
||||
r = store->mount();
|
||||
ASSERT_EQ(0, r);
|
||||
{
|
||||
cout << "removing" << std::endl;
|
||||
ObjectStore::Transaction t;
|
||||
t.remove(cid, oid);
|
||||
t.remove_collection(cid);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(StoreTest, FiemapEmpty) {
|
||||
ObjectStore::Sequencer osr("test");
|
||||
coll_t cid;
|
||||
|
Loading…
Reference in New Issue
Block a user