From: Olivier Houchard Date: Fri, 2 Oct 2026 15:24:20 +0000 (+0200) Subject: BUILD: Hopefully fix build on FreeBSD X-Git-Tag: v3.5-dev9~212 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=800c35cfc6905521079e6e7608e235890afaf42d;p=haproxy.git BUILD: Hopefully fix build on FreeBSD Commit 005038b80d468cdca0a9fdcb4b3c993ec02f8367 introduced a new script, to inject the gnu_debugdata section into the binary. However, the script used %b to print binary values, and %b behaves differently on Linux and FreeBSD shells, and on FreeBSD, it would end up corrupting the binary, making it crash on start. Fix that by avoid using %b at all. --- diff --git a/scripts/minidbg.sh b/scripts/minidbg.sh index bcb369e88..a3a732bb3 100755 --- a/scripts/minidbg.sh +++ b/scripts/minidbg.sh @@ -103,14 +103,15 @@ off=$(( (elflen + PAGE - 1) / PAGE * PAGE )) vaddr=$(( (maxva + PAGE - 1) / PAGE * PAGE )) # writes bytes of at , in the file's byte order +# Use escapes in the format: BSD printf's %b truncates at NUL bytes. wr() { _o=$1; _s=$2; _v=$3; _i=0; _e='' while [ $_i -lt $_s ]; do - _b=$(printf '\\0%03o' $(( (_v >> (8 * _i)) & 255 ))) + _b=$(printf '\\%03o' $(( (_v >> (8 * _i)) & 255 ))) if [ "$be" = 1 ]; then _e="$_b$_e"; else _e="$_e$_b"; fi _i=$(( _i + 1 )) done - printf '%b' "$_e" | dd of="$elf" bs=1 seek=$_o conv=notrunc 2>/dev/null || + printf "$_e" | dd of="$elf" bs=1 seek=$_o conv=notrunc 2>/dev/null || die "cannot patch $elf" }