From: Naveen Naidu Date: Mon, 20 Apr 2026 17:37:44 +0000 (+0530) Subject: Revert "common/version: strip trailing newline from vendor release file" X-Git-Tag: v21.0.1~358^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F68479%2Fhead;p=ceph.git Revert "common/version: strip trailing newline from vendor release file" Revert "src/common/version: append vendor release to ceph version(s) output" This reverts commits 5022557a0f23e131731224b11b466a79eb1042c0 and 541439b290001e1bb15dc9b2b40671671c2b85c4. As discussed in https://github.com/ceph/ceph/pull/67693, using a file-based approach to get the vendor version is not safe or correct. We are reverting this and will instead work on an approach where the version string is baked into the binary at build time. Fixes: https://tracker.ceph.com/issues/76134 Signed-off-by: Naveen Naidu --- diff --git a/src/common/version.cc b/src/common/version.cc index 19aa44cc6dd..5e41921339a 100644 --- a/src/common/version.cc +++ b/src/common/version.cc @@ -17,10 +17,6 @@ #include #include -#include -#include -#include - #include "ceph_ver.h" #include "common/ceph_strings.h" @@ -48,32 +44,6 @@ const char *git_version_to_str(void) return STRINGIFY(CEPH_GIT_VER); } -static std::string read_vendor_release_file() -{ - auto filename = "/etc/ceph_version"; - std::ifstream file(filename); - - if(!file.is_open()){ - return ""; - } - - std::string content; - try { - content.assign(std::istreambuf_iterator(file), std::istreambuf_iterator()); - } catch (const std::exception &e) { - return ""; - } - if (!content.empty()) { - while (!content.empty() && (content.back() == '\n' || content.back() == '\r')) { - content.pop_back(); - } - return std::string(" release ") + content; - } - - return ""; - -} - std::string const pretty_version_to_str(void) { std::ostringstream oss; @@ -85,7 +55,6 @@ std::string const pretty_version_to_str(void) #ifdef WITH_CRIMSON << " (crimson)" #endif - << read_vendor_release_file() ; return oss.str(); }