Mercurial > gnulib
changeset 38887:091cd881990e
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 ':'.
author | KO Myung-Hun <komh@chollian.net> |
---|---|
date | Sat, 07 Oct 2017 19:21:07 +0900 |
parents | a8a50efb1e7c |
children | 57fcc523f978 |
files | ChangeLog tests/init.sh |
diffstat | 2 files changed, 27 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Oct 07 14:07:41 2017 +0200 +++ b/ChangeLog Sat Oct 07 19:21:07 2017 +0900 @@ -1,3 +1,14 @@ +2017-10-07 KO Myung-Hun <komh@chollian.net> + + 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 <bruno@clisp.org> vma-iter: Fix truncated result on Linux (regression from 2017-09-26).
--- a/tests/init.sh Sat Oct 07 14:07:41 2017 +0200 +++ b/tests/init.sh Sat Oct 07 19:21:07 2017 +0900 @@ -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_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_" \