t/shelltest.od: Add a new preliminary test for IFS= behaviour.
Apparently in zsh (when in sh compatibility mode), IFS=/ will split
"/a/b/c/" into 5 parts ("", "a", "b", "c", ""). Other shells all seem
to agree that it's 4 parts ("", "a", "b", "c"). zsh seems maybe more
correct to me, but the majority rules, so we'll warn on it.
Meanwhile, we'll also fix the one place in minimal/do that failed due
to this oddity, since it's relatively easy to avoid.
Reported-by: shamrin@gmail.com
This commit is contained in:
parent
262d272f29
commit
b08b5efcef
2 changed files with 10 additions and 1 deletions
|
|
@ -196,7 +196,7 @@ _normpath()
|
||||||
fi
|
fi
|
||||||
set -f
|
set -f
|
||||||
IFS=/
|
IFS=/
|
||||||
for d in $path; do
|
for d in ${path%/}; do
|
||||||
#echo "NP out='$out' d='$d'" >&2
|
#echo "NP out='$out' d='$d'" >&2
|
||||||
if [ "$d" = ".." ]; then
|
if [ "$d" = ".." ]; then
|
||||||
out=$(_updir "${out%/}")/
|
out=$(_updir "${out%/}")/
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,15 @@ quiet_stderr()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
x="/a/b/c/"
|
||||||
|
IFS=/
|
||||||
|
f() {
|
||||||
|
[ "$2" = "a" ] || fail 2
|
||||||
|
[ "$#" = "4" ] || warn 2a
|
||||||
|
}
|
||||||
|
f $x
|
||||||
|
)
|
||||||
|
|
||||||
name=foo.o.o
|
name=foo.o.o
|
||||||
ext=.o
|
ext=.o
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue