Skip to content

Commit 1d56192

Browse files
committed
fix basename: illegal option -- b issue with upstream filenames starting with -
issue: ``` xiaods at XiaoTommydeMacBook-Pro in ~/go/src/github.com/openshift/origin on devel* $ export PATH="${PATH}:$( source hack/lib/init.sh; echo "${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/" )" basename: illegal option -- b usage: basename string [suffix] basename [-a] [-s suffix] string [...] ``` caused by : The -- (dash dash) stops basename from processing any options in the argument. Always quote $0 in case there are spaces in the name.
1 parent ea8f407 commit 1d56192

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hack/lib/init.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ os::log::stacktrace::install
5050
# them before every invocation.
5151
os::util::environment::update_path_var
5252

53-
if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
54-
os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
53+
if "$0" ~= *.sh; then
54+
os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
55+
else
56+
os::util::environment::setup_tmpdir_vars "shell"
5557
fi
5658

5759
# Allow setting $JUNIT_REPORT to toggle output behavior

0 commit comments

Comments
 (0)