From 81c0060b717f31d81136cc1eedf5ebe67d197203 Mon Sep 17 00:00:00 2001 From: cytopia Date: Mon, 28 Mar 2022 14:36:55 +0200 Subject: [PATCH] Ensure xargs with with -P option --- Dockerfiles/Dockerfile.alpine | 1 + tests/03-test-xargs.sh | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 tests/03-test-xargs.sh diff --git a/Dockerfiles/Dockerfile.alpine b/Dockerfiles/Dockerfile.alpine index fdb01a5..1a9ff7a 100644 --- a/Dockerfiles/Dockerfile.alpine +++ b/Dockerfiles/Dockerfile.alpine @@ -32,6 +32,7 @@ ENV BUILD_DEPS \ ENV RUN_DEPS \ ca-certificates \ bash \ + findutils \ openssl \ py-yaml \ supervisor \ diff --git a/tests/03-test-xargs.sh b/tests/03-test-xargs.sh new file mode 100755 index 0000000..5e7fada --- /dev/null +++ b/tests/03-test-xargs.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" + +IMAGE="${1}" +#NAME="${2}" +#VERSION="${3}" +TAG="${4}" +ARCH="${5}" + + +### +### Load Library +### +# shellcheck disable=SC1091 +. "${CWD}/.lib.sh" + + +RAND_NAME="$( get_random_name )" + +### +### Startup container +### +FILES="$( \ +run "docker run --rm --platform ${ARCH} \ + -e DEBUG_ENTRYPOINT=2 \ + -e DEBUG_RUNTIME=1 \ + -e NEW_UID=$( id -u ) \ + -e NEW_GID=$( id -g ) \ + --entrypoint=bash \ + --name ${RAND_NAME} ${IMAGE}:${TAG} -c ' + find /lib -print0 | xargs -n1 -0 -P 2 + '" +)" + +if [ -z "${FILES}" ]; then + >&2 echo "Error, no files found with 'find' and 'xargs'" + exit 1 +fi + +echo "[OK] xargs works"