This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch canopy
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 7a274d02f9d9fc37c3e8e9031889ddca4140340c
Author: gao <gao@local>
AuthorDate: Thu Jun 18 02:51:54 2026 +0000

    fix(release): strip macOS metadata from tarballs and document release 
targets
    
    Two related fixes for the release process:
    
    1. scripts/release.sh: exclude macOS AppleDouble (._*) and __MACOSX/
       metadata from all release tarballs (src, banyand, bydbctl, fodc-agent,
       fodc-proxy). Without this, downstream users running `make generate`
       (which invokes `buf generate`) hit 'invalid control character' errors
       when buf walks the ._* proto files bsdtar emits on macOS.
    
       Defense in depth:
         - export COPYFILE_DISABLE=1 at script top so bsdtar stops emitting
           AppleDouble files in the first place;
         - add --exclude="._*" --exclude="__MACOSX" to every tar
           invocation (src + 4 binary tarballs);
         - filter ._* / __MACOSX out of the find in copy_binaries() so they
           never reach the cp step.
    
    2. docs/installation/binaries.md: add a 'Reproduce the Official Release
       Artifacts' section showing the per-component release targets
       (`make -C banyand release`, etc.) that match the binaries shipped on
       the Apache mirror. The previous docs only described `make build`,
       which produces dev binaries (debug symbols retained, `<ver>-release`
       version string) that do NOT match the official artifacts.
---
 CHANGES.md                    |  1 +
 docs/installation/binaries.md | 27 +++++++++++++++++++++++++++
 scripts/release.sh            | 33 ++++++++++++++++++++++++++++-----
 3 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index a254f3fc2..cb5c81956 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -132,6 +132,7 @@ Release Notes.
 - Regenerate expired TLS test certificate with 100-year validity.
 - Set Ginkgo `--repeat` to 0 in the flaky-test workflow so the hourly run 
completes within the 50-minute timeout.
 - Refactor the dump tool into a reusable `banyand/dump` parser library.
+- Strip macOS AppleDouble (`._*`) and `__MACOSX/` metadata from every release 
tarball (src, banyand, bydbctl, fodc-agent, fodc-proxy) so downstream users 
running `make generate` from a downloaded source tarball no longer hit "invalid 
control character" errors when `buf generate` walks the resource-fork files; 
export `COPYFILE_DISABLE=1` and filter `._*` files at the source.
 
 ## 0.10.0
 
diff --git a/docs/installation/binaries.md b/docs/installation/binaries.md
index e71190506..4900f2004 100644
--- a/docs/installation/binaries.md
+++ b/docs/installation/binaries.md
@@ -109,6 +109,33 @@ The build system provides a series of binary options as 
well.
 
 > The build script now checks if the binary file exists before rebuilding. If 
 > you want to rebuild, please remove the binary file manually by running `make 
 > clean-build`.
 
+### Reproduce the Official Release Artifacts
+
+The commands above (`make generate && make build`) produce **development** 
binaries under `build/bin/dev/` (debug symbols included, larger on disk, 
version string reports `<ver>-release`). They are useful for local hacking but 
**do not match the binaries shipped in the release tarballs**.
+
+To reproduce the exact `banyand`, `bydbctl`, `fodc-agent` and `fodc-proxy` 
artifacts published on the Apache mirror, run the per-component `release` 
targets — the same sequence `scripts/release.sh` uses to package the official 
tarballs:
+
+```shell
+# Prerequisite: code generation must run first.
+make generate
+make -C ui build
+
+# Linux AMD64 + ARM64 — produces the official banyand, fodc-agent, fodc-proxy 
packages.
+TARGET_OS=linux PLATFORMS=linux/amd64,linux/arm64 make -C banyand     release
+TARGET_OS=linux PLATFORMS=linux/amd64,linux/arm64 make -C fodc/agent release
+TARGET_OS=linux PLATFORMS=linux/amd64,linux/arm64 make -C fodc/proxy release
+
+# bydbctl is cross-compiled to more targets because it is a single static 
binary.
+TARGET_OS=linux   PLATFORMS=linux/amd64,linux/arm64,linux/386   make -C 
bydbctl release
+TARGET_OS=windows PLATFORMS=windows/amd64,windows/386          make -C bydbctl 
release
+TARGET_OS=darwin  PLATFORMS=darwin/amd64,darwin/arm64          make -C bydbctl 
release
+
+# MCP server (no platform matrix — pure Node bundle).
+make -C mcp release
+```
+
+Each `release` target produces both `*-static-*` and `*-slim-*` variants where 
applicable. The `static` builds are stripped (`-s -w`) and statically linked; 
the `slim` builds additionally omit the embedded UI bundle. The resulting 
binaries land under `<component>/build/bin/<os>/<arch>/`, e.g. 
`banyand/build/bin/linux/amd64/banyand-server-static`. The version string in 
these binaries is set by `git describe` and looks like 
`v0.10.3-0-g<short-sha>-v0.10.x` rather than the `0.10.3-release`  [...]
+
 ### Cross-compile Binaries
 
 The build system supports cross-compiling binaries for different platforms. 
For example, to build a Windows binary on a Linux machine, you can issue the 
following command:
diff --git a/scripts/release.sh b/scripts/release.sh
index cb20d93dd..2d67f3abd 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -17,6 +17,12 @@
 #
 
 set -ex
+# Prevent `tar` from writing macOS AppleDouble (._*) and __MACOSX metadata into
+# release archives. Without this, downstream users running `make generate`
+# (which invokes `buf generate`) hit "invalid control character" errors when
+# the macOS-only resource-fork files are picked up by protoc.
+COPYFILE_DISABLE=1
+export COPYFILE_DISABLE
 SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 ROOTDIR=${SCRIPTDIR}/..
 BUILDDIR=${ROOTDIR}/build
@@ -54,7 +60,9 @@ binary(){
     cp -Rfv ./mcp/dist ${bindir}/mcp/
     cp -Rfv ./mcp/package.json ${bindir}/mcp/
     # Package
-    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-banyand.tgz -C 
${bindir} .
+    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-banyand.tgz \
+      --exclude="._*" --exclude="__MACOSX" \
+      -C ${bindir} .
 
     # Cross compile bydbctl
     TARGET_OS=linux PLATFORMS=linux/amd64,linux/arm64,linux/386 make -C 
bydbctl release
@@ -65,24 +73,37 @@ binary(){
     # Copy relevant files
     copy_binaries bydbctl
     # Package
-    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-bydbctl.tgz -C 
${bindir} .
+    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-bydbctl.tgz \
+      --exclude="._*" --exclude="__MACOSX" \
+      -C ${bindir} .
 
     # Build fodc-agent
     rm -rf ${bindir}/bin
     mkdir -p ${bindir}/bin
     copy_binaries fodc/agent
-    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-fodc-agent.tgz 
-C ${bindir} .
+    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-fodc-agent.tgz 
\
+      --exclude="._*" --exclude="__MACOSX" \
+      -C ${bindir} .
 
     # Build fodc-proxy
     rm -rf ${bindir}/bin
     mkdir -p ${bindir}/bin
     copy_binaries fodc/proxy
-    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-fodc-proxy.tgz 
-C ${bindir} .
+    tar -czf ${BUILDDIR}/skywalking-banyandb-${RELEASE_VERSION}-fodc-proxy.tgz 
\
+      --exclude="._*" --exclude="__MACOSX" \
+      -C ${bindir} .
 }
 
 copy_binaries() {
     local module=$1
-    find ./${module}/build/bin -type f -not -name "*.lock" | while read -r 
binary
+    # Filter out lock files AND macOS AppleDouble resource-fork files (._*) 
that
+    # bsdtar emits when run on macOS; otherwise they leak into release tarballs
+    # and break `buf generate` in downstream rebuilds.
+    find ./${module}/build/bin \
+        -type f \
+        -not -name "*.lock" \
+        -not -name "._*" \
+        -not -path "*/__MACOSX/*" | while read -r binary
     do
         # Extract os and arch from the path
         os_arch=$(echo ${binary} | awk -F'/' '{print $(NF-2)"/"$(NF-1)}')
@@ -100,6 +121,8 @@ source(){
     echo "RELEASE_VERSION=${RELEASE_VERSION}" > .env
     tar \
     --exclude=".DS_Store" \
+    --exclude="._*" \
+    --exclude="__MACOSX" \
     --exclude=".github" \
     --exclude=".gitignore" \
     --exclude=".asf.yaml" \

Reply via email to