From: Patrick Donnelly Date: Tue, 11 Mar 2025 14:26:23 +0000 (-0400) Subject: client: print readable encrypted names X-Git-Tag: testing/wip-vshankar-testing-20260120.085915-debug^2~13^2~70 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=44e0890c43bd13579fa538c287d6d15a1bc52696;p=ceph-ci.git client: print readable encrypted names Replace non-printable characters with '.'. Signed-off-by: Patrick Donnelly --- diff --git a/src/client/Client.cc b/src/client/Client.cc index d8cb7e1cf32..94082318552 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1316,7 +1316,7 @@ Dentry *Client::insert_dentry_inode(Dir *dir, const string& dname, LeaseStat *dl bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_name) { - ldout(cct, 20) << __func__ << ": (" << dname << " len=" << dname.size() << ", " << alternate_name << ") on " << diri << dendl; + ldout(cct, 20) << __func__ << ": (" << binstrprint(dname) << " len=" << dname.size() << ", " << binstrprint(alternate_name) << ") on " << diri << dendl; ceph_assert(dname.size() > 0); alternate_name = ""; @@ -1338,7 +1338,7 @@ bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_ /* confirm valid utf-8 name */ encoded = boost::locale::conv::to_utf(dname, "UTF-8", boost::locale::conv::stop); } catch (const boost::locale::conv::conversion_error& e) { - ldout(cct, 2) << "`" << dname << "' is not valid utf-8: " << e.what() << dendl; + ldout(cct, 2) << "`" << binstrprint(dname) << "' is not valid utf-8: " << e.what() << dendl; return false; } } else if (!encoding.empty()) { @@ -1377,7 +1377,7 @@ bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_ std::string folded; if (is_insensitive) { if (normalized.empty()) { - ldout(cct, 2) << __func__ << " normalization is required before case folding: " << dname << dendl; + ldout(cct, 2) << __func__ << " normalization is required before case folding: " << binstrprint(dname) << dendl; return false; } try { @@ -1427,7 +1427,7 @@ bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_ std::string Client::_unwrap_name(Inode& diri, const std::string& dname, const std::string& alternate_name) { - ldout(cct, 20) << __func__ << ": (" << dname << ", " << alternate_name << ") on " << diri << dendl; + ldout(cct, 20) << __func__ << ": (" << binstrprint(dname) << ", " << binstrprint(alternate_name) << ") on " << diri << dendl; std::string newdname = dname; std::string newaltn = alternate_name; @@ -1462,7 +1462,7 @@ std::string Client::_unwrap_name(Inode& diri, const std::string& dname, const st /* no reverse of normalization / encoding */ if (is_insensitive) { - ldout(cct, 25) << __func__ << ": = " << alternate_name << dendl; + ldout(cct, 25) << __func__ << ": = " << binstrprint(alternate_name) << dendl; newdname = newaltn; } } @@ -7858,7 +7858,7 @@ int Client::path_walk(InodeRef dirinode, const filepath& origpath, std::string trimmed_path = path.get_trimmed_path(); } - ldout(cct, 10) << __func__ << ": cur=" << *diri << " path=" << trimmed_path << dendl; + ldout(cct, 10) << __func__ << ": cur=" << *diri << " path=" << binstrprint(trimmed_path) << dendl; if (path.depth() == 0) { /* diri/dname can also be used as a filepath; or target */ @@ -7871,8 +7871,8 @@ int Client::path_walk(InodeRef dirinode, const filepath& origpath, while (i < path.depth() && diri) { int caps = 0; dname = path[i]; - ldout(cct, 10) << " " << i << " " << *diri << " " << dname << dendl; - ldout(cct, 20) << " (path is " << trimmed_path << ")" << dendl; + ldout(cct, 10) << " " << i << " " << *diri << " " << binstrprint(dname) << dendl; + ldout(cct, 20) << " (path is " << binstrprint(trimmed_path) << ")" << dendl; InodeRef next; if (!diri.get()->is_dir()) { ldout(cct, 20) << diri.get() << " is not a dir inode, name " << dname.c_str() << dendl; @@ -7941,6 +7941,7 @@ int Client::path_walk(InodeRef dirinode, const filepath& origpath, ret = -EPERM; goto out; } + ldout(cct, 25) << "decrypted symlink is: " << binstrprint(symlink) << dendl; } else { symlink = next->symlink; } @@ -16025,6 +16026,7 @@ int Client::_symlink(Inode *dir, const char *name, const char *target, delete req; return r; } + ldout(cct, 25) << "encrypted symlink is: " << binstrprint(enc_target) << dendl; req->set_string2(enc_target.c_str()); } else { req->set_string2(target); diff --git a/src/include/filepath.h b/src/include/filepath.h index 232361d1217..83cd15384ba 100644 --- a/src/include/filepath.h +++ b/src/include/filepath.h @@ -165,6 +165,7 @@ class filepath { // walk into snapdir? return depth() > 0 && bits[0].length() == 0; } + }; WRITE_CLASS_ENCODER(filepath)