From a006d7eae02772e9c25dd69a5ac5c7fc612a2f54 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 27 Nov 2023 14:52:42 +0000 Subject: [PATCH] 8294549: configure script should detect unsupported path Co-authored-by: Mike Duigou Reviewed-by: erikj --- configure | 12 ++++++++---- make/autoconf/configure | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/configure b/configure index f3b1c536875..78d30564267 100644 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,14 @@ # make sure that is called using bash. # Get an absolute path to this script, since that determines the top-level directory. -this_script_dir=`dirname $0` -this_script_dir=`cd $this_script_dir > /dev/null && pwd` +source_path="$(dirname ${0})" +this_script_dir="$(cd -- "${source_path}" > /dev/null && pwd)" +if test -z "${this_script_dir}"; then + echo "Error: Could not determine location of configure script" + exit 1 +fi # Delegate to wrapper, forcing wrapper to believe $0 is this script by using -c. # This trick is needed to get autoconf to co-operate properly. # The ${-:+-$-} construction passes on bash options. -bash ${-:+-$-} -c ". $this_script_dir/make/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@" +bash ${-:+-$-} -c ". \"${this_script_dir}/make/autoconf/configure\"" "${this_script_dir}/configure" CHECKME "${this_script_dir}" "$@" diff --git a/make/autoconf/configure b/make/autoconf/configure index 4b26e3d7061..6fa0aacfbc9 100644 --- a/make/autoconf/configure +++ b/make/autoconf/configure @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,12 @@ if test "x$BASH" = x; then echo "Error: This script must be run using bash." 1>&2 exit 1 fi + +if [[ "$TOPDIR" =~ .*[[:space:]]+.* ]]; then + echo "Error: Build path containing space character is not supported" 1>&2 + exit 1 +fi + # Force autoconf to use bash. This also means we must disable autoconf re-exec. export CONFIG_SHELL=$BASH export _as_can_reexec=no