Bruno Haible wrote:
> KO Myung-Hun wrote:
>>> Does the init.sh test failure go away with this patch?
>>>
>>
>> 'shopt' related failure disappeared.
> 
> OK, I've pushed the patch.
> 
>> However, 'invalid path dir' is
>> still. I looked into that. And ':' was a problem. Because ':' is not a
>> path separator on OS/2. Instead it's used as a separator of a drive
>> letter and directory parts.
>>
>> I tried to use $PATH_SEPARATOR. However, it has nothing.
>>
>> Any idea ?
> 
> PATH_SEPARATOR is the right approach, yes. In m4/progtest.m4 and m4/lib-ld.m4
> you find a code snippet that determines PATH_SEPARATOR. You can copy this to
> init.sh.
> 

Ok. Here is the patch.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

From 360688f6b0bda6edf5a684e85c1b837635ad5d02 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
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 ':'.
---
 tests/init.sh | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tests/init.sh b/tests/init.sh
index 0821c572a..24fb51219 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.13.3

Reply via email to