From 652f26f9c599dbb960afff627c435fa64f95b961 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 5 Jun 2020 08:46:50 +0000 Subject: [PATCH] Avoid using non-portable dd status=none flag Copying the approach chosen in r309412. This fixes building the libc tests on a macOS host since the macOS /bin/dd binary does not support status=none. As there only seem to be two uses, this commit changes the two Makefiles. If this becomes more common, we could also add a wrapper bootstrap script that ignores status= and forwards the remaining args to the real dd. Another alternative would be to remove the status flag and pipe stderr to /dev/null, but them we lose error messages. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D24785 --- lib/libc/tests/gen/posix_spawn/Makefile | 6 +++++- lib/libc/tests/sys/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libc/tests/gen/posix_spawn/Makefile b/lib/libc/tests/gen/posix_spawn/Makefile index 9b687c6d5fed..21feba9dce05 100644 --- a/lib/libc/tests/gen/posix_spawn/Makefile +++ b/lib/libc/tests/gen/posix_spawn/Makefile @@ -19,8 +19,12 @@ CLEANFILES+= h_nonexec .include "../../Makefile.netbsd-tests" +# The dd status=none option is non-standard. Only use it when this test succeeds +# rather than require dd to be a bootstrap tool. +DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true +DD=dd ${DD_NOSTATUS} h_zero: - dd if=/dev/zero of=h_zero bs=1k count=2 status=none + ${DD} if=/dev/zero of=h_zero bs=1k count=2 chmod a+x h_zero CLEANFILES+= h_zero diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index 72dc29b6b54a..5534e4ba0f50 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -96,7 +96,11 @@ truncate_test_FILESGRP= wheel truncate_test_FILESPACKAGE= ${PACKAGE} CLEANFILES= truncate_test.root_owned +# The dd status=none option is non-standard. Only use it when this test succeeds +# rather than require dd to be a bootstrap tool. +DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true +DD=dd ${DD_NOSTATUS} truncate_test.root_owned: - dd if=/dev/null bs=1 count=1 of=${.TARGET} status=none + ${DD} if=/dev/null bs=1 count=1 of=${.TARGET} .include