summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/sh/exec.c25
-rw-r--r--tools/regression/bin/sh/execution/hash1.012
2 files changed, 13 insertions, 24 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index 6297e9b..67eafff 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -494,30 +494,7 @@ hashcd(void)
void
changepath(const char *newval)
{
- const char *old, *new;
- int idx;
- int firstchange;
-
- old = pathval();
- new = newval;
- firstchange = 9999; /* assume no change */
- idx = 0;
- for (;;) {
- if (*old != *new) {
- firstchange = idx;
- if ((*old == '\0' && *new == ':')
- || (*old == ':' && *new == '\0'))
- firstchange++;
- old = new; /* ignore subsequent differences */
- }
- if (*new == '\0')
- break;
- if (*new == ':') {
- idx++;
- }
- new++, old++;
- }
- clearcmdentry(firstchange);
+ clearcmdentry(0);
}
diff --git a/tools/regression/bin/sh/execution/hash1.0 b/tools/regression/bin/sh/execution/hash1.0
new file mode 100644
index 0000000..a645c2a
--- /dev/null
+++ b/tools/regression/bin/sh/execution/hash1.0
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+PATH=$T:$PATH
+ls -ld . >/dev/null
+cat <<EOF >"$T/ls"
+:
+EOF
+chmod 755 "$T/ls"
+PATH=$PATH
+ls -ld .
OpenPOWER on IntegriCloud