[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Not all shells search PATH for `sh script'
From: |
Ralf Wildenhues |
Subject: |
Not all shells search PATH for `sh script' |
Date: |
Sun, 21 Oct 2007 20:15:40 +0200 |
User-agent: |
Mutt/1.5.16 (2007-10-11) |
It is guaranteed that with `/bin/sh script', the shell searches in the
current directory for `script', no matter whether `.' or `pwd' is in
$PATH. However, POSIX only allows but not requires that it also search
$PATH if the script is not in `.'. FreeBSD's shell, for example, does
not search $PATH.
(I know you knew all that, but I didn't, so I'm writing that down for
myself. ;-)
I've fixed the test as shown below.
Cheers,
Ralf
2007-10-21 Ralf Wildenhues <address@hidden>
Fix `Deep Package' test failure on FreeBSD.
* tests/torture.at (Deep Package): Do not add `.' to $PATH
unnecessarily. Do not try running `/bin/sh configure' with a
configure script to be found in $PATH, if the shell does not do
this resolution. Fixes test failure on FreeBSD.
diff --git a/tests/torture.at b/tests/torture.at
index 0a835ba..4ffaafb 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1160,7 +1160,7 @@ chmod a-w inner/innermost inner
AT_CHECK([./configure --help=recursive | grep " INNER "], 0, [ignore])
AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
AT_CHECK([/bin/sh ./configure --help=recursive | grep " INNERMOST "], 0,
[ignore])
-AT_CHECK([PATH=.$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep
" INNERMOST "], 0, [ignore])
+AT_CHECK([/bin/sh configure --help=recursive | grep " INNERMOST "], 0,
[ignore])
AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; configure --help=recursive
| grep " INNERMOST "], 0, [ignore])
chmod u+w inner inner/innermost
@@ -1176,7 +1176,10 @@ chmod a-w builddir inner/innermost inner
AT_CHECK([cd builddir && ../configure --help=recursive | grep " INNER "],
0, [ignore])
AT_CHECK([cd builddir && ../configure --help=recursive | grep " INNERMOST "],
0, [ignore])
AT_CHECK([cd builddir && /bin/sh ../configure --help=recursive | grep "
INNERMOST "], 0, [ignore])
-AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure
--help=recursive | grep " INNERMOST "], 0, [ignore])
+# Not all shells search $PATH for scripts.
+if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help)
>/dev/null 2>&1; then
+ AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure
--help=recursive | grep " INNERMOST "], 0, [ignore])
+fi
AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir &&
configure --help=recursive | grep " INNERMOST "], 0, [ignore])
chmod u+w builddir inner inner/innermost
AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Not all shells search PATH for `sh script',
Ralf Wildenhues <=