From 20f61f8a039748775f417aa023339c658725ccfe Mon Sep 17 00:00:00 2001 From: Hobbs Date: Fri, 8 Mar 2024 13:47:07 -0800 Subject: [PATCH] docker: add script help message for macOS Problem: recently, several core developers have noted that the docker-run-checks.sh script borks when command-line options that specify values do so with an equals sign rather than a space on macOS. Add a help message to show up on macOS reminding devs to strip all '=' and replace them with spaces in their command-line arguments if BSD getopt is used. Also, give users the option to set an environment variable to tell the script on macOS that it should assume GNU getopt is being used ('FORCE_GNU_GETOPT=1'). --- src/test/docker/docker-run-checks.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/docker/docker-run-checks.sh b/src/test/docker/docker-run-checks.sh index d0bcdbe53c14..5e2a7150d156 100755 --- a/src/test/docker/docker-run-checks.sh +++ b/src/test/docker/docker-run-checks.sh @@ -27,7 +27,7 @@ die() { echo -e "$prog: $@"; exit 1; } # declare -r long_opts="help,quiet,interactive,image:,flux-security-version:,jobs:,no-cache,no-home,distcheck,tag:,build-directory:,install-only,no-poison,recheck,unit-test-only,quick-check,inception,platform:,workdir:,system" declare -r short_opts="hqIdi:S:j:t:D:Prup:" -declare -r usage=" +declare usage=" Usage: $prog [OPTIONS] -- [CONFIGURE_ARGS...]\n\ Build docker image for CI builds, then run tests inside the new\n\ container as the current user and group.\n\ @@ -59,9 +59,14 @@ Options:\n\ " # check if running in OSX -if [[ "$(uname)" == "Darwin" ]]; then +if [[ "$(uname)" == "Darwin" ]] && [[ $FORCE_GNU_GETOPT != 1 ]]; then # BSD getopt GETOPTS=`getopt $short_opts -- $*` + export EXTRA_MACOS_STUFF="\n\ + You are using BSD getopt on macOS. BSD getopt does not recognize '='\n\ + between options. Use a space instead. If gnu-getopt is first in your\n\ + PATH, force the script to use that by setting FORCE_GNU_GETOPT=1.\n" + usage=${usage}${EXTRA_MACOS_STUFF} else # GNU getopt GETOPTS=`getopt -u -o $short_opts -l $long_opts -n $prog -- $@`