From 9cfa15fd1f87dabd7523e8c12b7f7bc026ad939f Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Tue, 14 Jul 2026 18:46:04 +0000 Subject: [PATCH] build(qemu): fix grep portability and document container-only rm -rf Use 'CONFIG_VIRTIO_MEM=' prefix match instead of '\b' word boundary in grep -v: \b is a GNU extension not guaranteed by POSIX, making the ppc64le VIRTIO_MEM exclusion unreliable on non-GNU grep implementations. Add a comment on the rm -rf call to make clear this script always runs inside a dedicated build container, so deleting a relative path is safe. Assisted-by: Claude Sonnet 4.6 Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/build-qemu.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/packaging/static-build/qemu/build-qemu.sh b/tools/packaging/static-build/qemu/build-qemu.sh index fb3117a4e7..865e346ee6 100755 --- a/tools/packaging/static-build/qemu/build-qemu.sh +++ b/tools/packaging/static-build/qemu/build-qemu.sh @@ -26,6 +26,8 @@ HYPERVISOR_NAME="${HYPERVISOR_NAME:-}" PREFIX="${PREFIX:-}" PKGVERSION=${PKGVERSION:-} +# This script always runs inside a dedicated build container (see +# static-build/qemu/Dockerfile), so rm -rf of a relative path is safe. rm -rf qemu git clone --depth=1 "${QEMU_REPO}" qemu pushd qemu @@ -85,7 +87,7 @@ elif [[ "${ARCH}" == "aarch64" ]]; then elif [[ "${ARCH}" == "ppc64le" ]]; then # VIRTIO_MEM depends on VIRTIO_MEM_SUPPORTED, which is only selected on # arm/i386/s390x — ppc64 PSeries does not support virtio-mem. - _PPC64_DEVS=$(printf '%s' "${_COMMON_DEVS}" | grep -v 'VIRTIO_MEM\b') + _PPC64_DEVS=$(printf '%s' "${_COMMON_DEVS}" | grep -v 'CONFIG_VIRTIO_MEM=') printf 'CONFIG_PSERIES=y\n%s\n' "${_PPC64_DEVS}" \ >> configs/devices/ppc64-softmmu/default.mak unset _PPC64_DEVS