From 295ee304a49539597e351a88b25adb7328e3bbd3 Mon Sep 17 00:00:00 2001 From: Shai Bennathan Date: Mon, 7 Aug 2023 12:51:09 +0300 Subject: [PATCH 1/2] Issue: Launch failure via bin/bash Currently if run.sh is launched via 'bin/bash run.sh', when run.sh is not in the local directory (i.e., accessed via path env var) it thinks it runs in the local directory. This change makes sure that all cases are covered. Tested on local Ubuntu 22.04. --- pmd-dist/src/main/resources/scripts/pmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-dist/src/main/resources/scripts/pmd b/pmd-dist/src/main/resources/scripts/pmd index 926238f9da2..5da1418e005 100755 --- a/pmd-dist/src/main/resources/scripts/pmd +++ b/pmd-dist/src/main/resources/scripts/pmd @@ -52,7 +52,7 @@ set_lib_dir() { if [ -L "$0" ]; then local script_real_loc=$(readlink "$0") else - local script_real_loc=$0 + local script_real_loc=${BASH_SOURCE[0]} fi local script_dir=$(dirname "${script_real_loc}") From 56ae02ad3547e80dc082624a9f38c42e4c45aa7f Mon Sep 17 00:00:00 2001 From: Shai Bennathan Date: Mon, 7 Aug 2023 15:32:11 +0300 Subject: [PATCH 2/2] Update pmd-dist/src/main/resources/scripts/pmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Juan Martín Sotuyo Dodero --- pmd-dist/src/main/resources/scripts/pmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-dist/src/main/resources/scripts/pmd b/pmd-dist/src/main/resources/scripts/pmd index 5da1418e005..50010b43109 100755 --- a/pmd-dist/src/main/resources/scripts/pmd +++ b/pmd-dist/src/main/resources/scripts/pmd @@ -52,7 +52,7 @@ set_lib_dir() { if [ -L "$0" ]; then local script_real_loc=$(readlink "$0") else - local script_real_loc=${BASH_SOURCE[0]} + local script_real_loc=${BASH_SOURCE[0]:-${(%):-%x}} fi local script_dir=$(dirname "${script_real_loc}")