From: Naveen Naidu Date: Mon, 30 Mar 2026 16:18:49 +0000 (+0530) Subject: common/version: strip trailing newline from vendor release file X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F68111%2Fhead;p=ceph.git common/version: strip trailing newline from vendor release file read_vendor_release_file() reads /etc/ceph_version which may have a trailing newline, causing "ceph version" to produce invalid JSON output. Strip trailing \n and \r characters before returning the content. Signed-off-by: Naveen Naidu --- diff --git a/src/common/version.cc b/src/common/version.cc index c45faba6491b..19aa44cc6dd7 100644 --- a/src/common/version.cc +++ b/src/common/version.cc @@ -64,6 +64,9 @@ static std::string read_vendor_release_file() return ""; } if (!content.empty()) { + while (!content.empty() && (content.back() == '\n' || content.back() == '\r')) { + content.pop_back(); + } return std::string(" release ") + content; }