From ca973635730c6b1cb108b04e44efc56db0782761 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 7 Oct 2017 19:21:07 +0900 Subject: [PATCH] tests: fix 'invalid path dir' error On OS/2, a path separator is ';' not ':'. And ':' is used as a separator between a drive letter and directory parts. As a result, an absolute path such as x:/path/to/dir on OS/2 is treated as an invalid path dir. * tests/init.sh (PATH_SEPARATOR): Set at startup. (path_prepend_): '?:*' is also an absolute path. Use $PATH_SEPARATOR instead of hard coded ':'. --- ChangeLog | 11 +++++++++++ tests/init.sh | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74d1d1ec17..8a225e924d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-10-07 KO Myung-Hun + + test-framework-sh: Fix 'invalid path dir' error. + On OS/2, a path separator is ';' not ':'. And ':' is used as a + separator between a drive letter and directory parts. + As a result, an absolute path such as x:/path/to/dir on OS/2 is + treated as an invalid path dir. + * tests/init.sh (PATH_SEPARATOR): Set at startup. + (path_prepend_): '?:*' is also an absolute path. Use $PATH_SEPARATOR + instead of hard coded ':'. + 2017-10-07 Bruno Haible vma-iter: Fix truncated result on Linux (regression from 2017-09-26). diff --git a/tests/init.sh b/tests/init.sh index 0821c572ae..24fb51219a 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -62,6 +62,19 @@ ME_=`expr "./$0" : '.*/\(.*\)$'` +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + # We use a trap below for cleanup. This requires us to go through # hoops to get the right exit status transported through the handler. # So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests. @@ -429,13 +442,13 @@ path_prepend_ () path_dir_=$1 case $path_dir_ in '') fail_ "invalid path dir: '$1'";; - /*) abs_path_dir_=$path_dir_;; + /* | ?:*) abs_path_dir_=$path_dir_;; *) abs_path_dir_=$initial_cwd_/$path_dir_;; esac case $abs_path_dir_ in - *:*) fail_ "invalid path dir: '$abs_path_dir_'";; + *$PATH_SEPARATOR*) fail_ "invalid path dir: '$abs_path_dir_'";; esac - PATH="$abs_path_dir_:$PATH" + PATH="$abs_path_dir_$PATH_SEPARATOR$PATH" # Create an alias, FOO, for each FOO.exe in this directory. create_exe_shims_ "$abs_path_dir_" \ -- 2.39.5