fix(claim): use printf for portable newline handling in claim script (#21665)
fix(claim): use printf instead of echo for portable newline handling Replace echo with printf '%b\n' when writing claim.conf to ensure backslash escape sequences (\n) are interpreted correctly on all POSIX shells. On Rocky 9 and other systems where /bin/sh does not interpret \n in echo, the claim.conf file was written with literal \n characters instead of actual newlines, causing claiming to fail.
Costa Tsaousis committed
Jan 29, 2026 at 07:47 UTC
284203fb4dc88ccf716625f1fc635bf3eb31b10f
1 file changed
+1
-1
src/claim/netdata-claim.sh.in
+1
-1
@@ -52,7 +52,7 @@ write_config() {
52
touch "${claim_config}.tmp"
53
chmod 0660 "${claim_config}.tmp"
54
chown "root:${netdata_group}" "${claim_config}.tmp"
55
- echo "${config}" > "${claim_config}.tmp"
55
+ printf '%b\n' "${config}" > "${claim_config}.tmp"
56
chmod 0640 "${claim_config}.tmp"
57
mv -f "${claim_config}.tmp" "${claim_config}"
58
}