From b46198c3e64438155f524ee1df83cb3bb797fafb Mon Sep 17 00:00:00 2001 From: Dianjin Wang Date: Sat, 12 Sep 2026 08:30:42 +0800 Subject: [PATCH] gpdemo: write an absolute TRUSTED_SHELL into the generated config demo_cluster.sh writes the cluster config through an unquoted here-doc, so TRUSTED_SHELL="$(dirname "$0")/lalshell" is expanded as the file is written, not as it is sourced. gpAux/gpdemo's Makefile invokes the script as ./demo_cluster.sh, which makes $0 relative and dirname "." -- so the generated config carries TRUSTED_SHELL="./lalshell" gpinitsystem sources that file from wherever it happens to be running and looks for lalshell in that directory instead. Nothing noticed while the demo cluster was only ever created by demo_cluster.sh itself, from the directory lalshell sits in, but the Behave suite runs gpinitsystem -a -c ../gpAux/gpdemo/clusterConfigFile directly in a dozen scenarios. Resolve the directory the script itself lives in and write that, and keep the quotes so a path containing whitespace survives being sourced. --- gpAux/gpdemo/demo_cluster.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gpAux/gpdemo/demo_cluster.sh b/gpAux/gpdemo/demo_cluster.sh index 225bb76a5ee..42973227b36 100755 --- a/gpAux/gpdemo/demo_cluster.sh +++ b/gpAux/gpdemo/demo_cluster.sh @@ -314,8 +314,13 @@ cat >> $CLUSTER_CONFIG <<-EOF COORDINATOR_PORT=${COORDINATOR_DEMO_PORT} - # Shell to use to execute commands on all hosts - TRUSTED_SHELL="$(dirname "$0")/lalshell" + # Shell to use to execute commands on all hosts. gpinitsystem sources this + # file from whatever directory it runs in, so the path has to be absolute; + # \$(dirname \$0) on its own is relative whenever this script was invoked by + # a relative path. Resolve the directory holding lalshell -- the one this + # script lives in -- and quote it so a path containing whitespace survives + # being sourced. + TRUSTED_SHELL="$(cd "$(dirname "$0")" && pwd)/lalshell" ENCODING=UNICODE EOF