]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "common/version: strip trailing newline from vendor release file" 68479/head
authorNaveen Naidu <naveennaidu479@gmail.com>
Mon, 20 Apr 2026 17:37:44 +0000 (23:07 +0530)
committerNaveen Naidu <naveennaidu479@gmail.com>
Tue, 21 Apr 2026 13:13:58 +0000 (18:43 +0530)
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 <naveennaidu479@gmail.com>
src/common/version.cc

index 19aa44cc6dd77d90fc9d97ecb1df2338ad6a24ec..5e41921339a4c8e5459121b227c1013d48c7a555 100644 (file)
 
 #include <stdlib.h>
 #include <sstream>
-#include <fstream>
-#include <string>
-#include <iterator>
-
 
 #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<char>(file), std::istreambuf_iterator<char>());
-  } 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();
 }