rcsid sync from obsd; misc sync; small improvements

• mksh testsuite no longer uses printf, again
• use MAXPATHLEN from <sys/param.h> as PATH_MAX fallback
This commit is contained in:
tg 2015-01-25 15:23:43 +00:00
parent d5bdd0e364
commit 934929c2ee
4 changed files with 155 additions and 126 deletions

249
check.t
View File

@ -1,8 +1,8 @@
# $MirOS: src/bin/mksh/check.t,v 1.676 2015/01/04 21:08:08 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.677 2015/01/25 15:23:39 tg Exp $
# -*- mode: sh -*- # -*- mode: sh -*-
#- #-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014 # 2011, 2012, 2013, 2014, 2015
# Thorsten Glaser <tg@mirbsd.org> # Thorsten Glaser <tg@mirbsd.org>
# #
# Provided that these terms and disclaimer and all copyright notices # Provided that these terms and disclaimer and all copyright notices
@ -30,7 +30,7 @@
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R50 2015/01/04 @(#)MIRBSD KSH R50 2015/01/25
description: description:
Check version of shell. Check version of shell.
stdin: stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: shell:legacy-no category: shell:legacy-no
--- ---
expected-stdout: expected-stdout:
@(#)LEGACY KSH R50 2015/01/04 @(#)LEGACY KSH R50 2015/01/25
description: description:
Check version of legacy shell. Check version of legacy shell.
stdin: stdin:
@ -3614,23 +3614,23 @@ name: IFS-space-1
description: description:
Simple test, default IFS Simple test, default IFS
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
set -- A B C set -- A B C
showargs 1 $* showargs 1 $*
showargs 2 "$*" showargs 2 "$*"
showargs 3 $@ showargs 3 $@
showargs 4 "$@" showargs 4 "$@"
expected-stdout: expected-stdout:
<1> <A> <B> <C> <1> <A> <B> <C> .
<2> <A B C> <2> <A B C> .
<3> <A> <B> <C> <3> <A> <B> <C> .
<4> <A> <B> <C> <4> <A> <B> <C> .
--- ---
name: IFS-colon-1 name: IFS-colon-1
description: description:
Simple test, IFS=: Simple test, IFS=:
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS=: IFS=:
set -- A B C set -- A B C
showargs 1 $* showargs 1 $*
@ -3638,16 +3638,16 @@ stdin:
showargs 3 $@ showargs 3 $@
showargs 4 "$@" showargs 4 "$@"
expected-stdout: expected-stdout:
<1> <A> <B> <C> <1> <A> <B> <C> .
<2> <A:B:C> <2> <A:B:C> .
<3> <A> <B> <C> <3> <A> <B> <C> .
<4> <A> <B> <C> <4> <A> <B> <C> .
--- ---
name: IFS-null-1 name: IFS-null-1
description: description:
Simple test, IFS="" Simple test, IFS=""
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="" IFS=""
set -- A B C set -- A B C
showargs 1 $* showargs 1 $*
@ -3655,16 +3655,16 @@ stdin:
showargs 3 $@ showargs 3 $@
showargs 4 "$@" showargs 4 "$@"
expected-stdout: expected-stdout:
<1> <A> <B> <C> <1> <A> <B> <C> .
<2> <ABC> <2> <ABC> .
<3> <A> <B> <C> <3> <A> <B> <C> .
<4> <A> <B> <C> <4> <A> <B> <C> .
--- ---
name: IFS-space-colon-1 name: IFS-space-colon-1
description: description:
Simple test, IFS=<white-space>: Simple test, IFS=<white-space>:
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="$IFS:" IFS="$IFS:"
set -- set --
showargs 1 $* showargs 1 $*
@ -3673,52 +3673,52 @@ stdin:
showargs 4 "$@" showargs 4 "$@"
showargs 5 : "$@" showargs 5 : "$@"
expected-stdout: expected-stdout:
<1> <1> .
<2> <> <2> <> .
<3> <3> .
<4> <4> .
<5> <:> <5> <:> .
--- ---
name: IFS-space-colon-2 name: IFS-space-colon-2
description: description:
Simple test, IFS=<white-space>: Simple test, IFS=<white-space>:
AT&T ksh fails this, POSIX says the test is correct. AT&T ksh fails this, POSIX says the test is correct.
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="$IFS:" IFS="$IFS:"
set -- set --
showargs :"$@" showargs :"$@"
expected-stdout: expected-stdout:
<:> <:> .
--- ---
name: IFS-space-colon-4 name: IFS-space-colon-4
description: description:
Simple test, IFS=<white-space>: Simple test, IFS=<white-space>:
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="$IFS:" IFS="$IFS:"
set -- set --
showargs "$@$@" showargs "$@$@"
expected-stdout: expected-stdout:
.
--- ---
name: IFS-space-colon-5 name: IFS-space-colon-5
description: description:
Simple test, IFS=<white-space>: Simple test, IFS=<white-space>:
Don't know what POSIX thinks of this. AT&T ksh does not do this. Don't know what POSIX thinks of this. AT&T ksh does not do this.
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="$IFS:" IFS="$IFS:"
set -- set --
showargs "${@:-}" showargs "${@:-}"
expected-stdout: expected-stdout:
<> <> .
--- ---
name: IFS-subst-1 name: IFS-subst-1
description: description:
Simple test, IFS=<white-space>: Simple test, IFS=<white-space>:
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="$IFS:" IFS="$IFS:"
x=":b: :" x=":b: :"
echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo
@ -3740,58 +3740,58 @@ stdin:
expected-stdout: expected-stdout:
1: [] [b] [] 1: [] [b] []
2: [:b::] 2: [:b::]
<3> <> <b> <> <3> <> <b> <> .
<4> <:b::> <4> <:b::> .
5: [a] [b] 5: [a] [b]
<6> <a> <b> <6> <a> <b> .
7: [a] [] [c] 7: [a] [] [c]
<8> <a> <> <c> <8> <a> <> <c> .
9: [h] [ith] [ere] 9: [h] [ith] [ere]
<10> <h> <ith> <ere> <10> <h> <ith> <ere> .
<11> <h:ith:ere> <11> <h:ith:ere> .
12: [A] [B] [] [D] 12: [A] [B] [] [D]
<13> <A> <B> <> <D> <13> <A> <B> <> <D> .
--- ---
name: IFS-subst-2 name: IFS-subst-2
description: description:
Check leading whitespace after trim does not make a field Check leading whitespace after trim does not make a field
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
x="X 1 2" x="X 1 2"
showargs 1 shift ${x#X} showargs 1 shift ${x#X}
expected-stdout: expected-stdout:
<1> <shift> <1> <2> <1> <shift> <1> <2> .
--- ---
name: IFS-subst-3-arr name: IFS-subst-3-arr
description: description:
Check leading IFS non-whitespace after trim does make a field Check leading IFS non-whitespace after trim does make a field
but leading IFS whitespace does not, nor empty replacements but leading IFS whitespace does not, nor empty replacements
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
showargs 0 ${-+} showargs 0 ${-+}
IFS=: IFS=:
showargs 1 ${-+:foo:bar} showargs 1 ${-+:foo:bar}
IFS=' ' IFS=' '
showargs 2 ${-+ foo bar} showargs 2 ${-+ foo bar}
expected-stdout: expected-stdout:
<0> <0> .
<1> <> <foo> <bar> <1> <> <foo> <bar> .
<2> <foo> <bar> <2> <foo> <bar> .
--- ---
name: IFS-subst-3-ass name: IFS-subst-3-ass
description: description:
Check non-field semantics Check non-field semantics
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
showargs 0 x=${-+} showargs 0 x=${-+}
IFS=: IFS=:
showargs 1 x=${-+:foo:bar} showargs 1 x=${-+:foo:bar}
IFS=' ' IFS=' '
showargs 2 x=${-+ foo bar} showargs 2 x=${-+ foo bar}
expected-stdout: expected-stdout:
<0> <x=> <0> <x=> .
<1> <x=> <foo> <bar> <1> <x=> <foo> <bar> .
<2> <x=> <foo> <bar> <2> <x=> <foo> <bar> .
--- ---
name: IFS-subst-3-lcl name: IFS-subst-3-lcl
description: description:
@ -3808,11 +3808,12 @@ name: IFS-subst-4-1
description: description:
reported by mikeserv reported by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a IFS=\ ; set -- $a
IFS= ; q="$*" ; nq=$* IFS= ; q="$*" ; nq=$*
printf '<%s>\n' "$*" $* "$q" "$nq" pfn "$*" $* "$q" "$nq"
[ "$q" = "$nq" ] && echo =true || echo =false [ "$q" = "$nq" ] && echo =true || echo =false
expected-stdout: expected-stdout:
<spacedivdedargument <spacedivdedargument
@ -3831,11 +3832,12 @@ name: IFS-subst-4-2
description: description:
extended testsuite based on problem by mikeserv extended testsuite based on problem by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a IFS=\ ; set -- $a
IFS= ; q="$@" ; nq=$@ IFS= ; q="$@" ; nq=$@
printf '<%s>\n' "$*" $* "$q" "$nq" pfn "$*" $* "$q" "$nq"
[ "$q" = "$nq" ] && echo =true || echo =false [ "$q" = "$nq" ] && echo =true || echo =false
expected-stdout: expected-stdout:
<spacedivdedargument <spacedivdedargument
@ -3854,6 +3856,7 @@ name: IFS-subst-4-3
description: description:
extended testsuite based on problem by mikeserv extended testsuite based on problem by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a; IFS= IFS=\ ; set -- $a; IFS=
@ -3861,14 +3864,14 @@ stdin:
nqs=$* nqs=$*
qk="$@" qk="$@"
nqk=$@ nqk=$@
printf '= qs '; printf '<%s>\n' "$qs" print -nr -- '= qs '; pfn "$qs"
printf '=nqs '; printf '<%s>\n' "$nqs" print -nr -- '=nqs '; pfn "$nqs"
printf '= qk '; printf '<%s>\n' "$qk" print -nr -- '= qk '; pfn "$qk"
printf '=nqk '; printf '<%s>\n' "$nqk" print -nr -- '=nqk '; pfn "$nqk"
printf '~ qs '; printf '<%s>\n' "$*" print -nr -- '~ qs '; pfn "$*"
printf '~nqs '; printf '<%s>\n' $* print -nr -- '~nqs '; pfn $*
printf '~ qk '; printf '<%s>\n' "$@" print -nr -- '~ qk '; pfn "$@"
printf '~nqk '; printf '<%s>\n' $@ print -nr -- '~nqk '; pfn $@
expected-stdout: expected-stdout:
= qs <spacedivdedargument = qs <spacedivdedargument
here> here>
@ -3897,21 +3900,22 @@ name: IFS-subst-4-4
description: description:
extended testsuite based on problem by mikeserv extended testsuite based on problem by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a; IFS= IFS=\ ; set -- $a; IFS=
qs="$*" qs="$*"
printf '= qs '; printf '<%s>\n' "$qs" print -nr -- '= qs '; pfn "$qs"
printf '~ qs '; printf '<%s>\n' "$*" print -nr -- '~ qs '; pfn "$*"
nqs=$* nqs=$*
printf '=nqs '; printf '<%s>\n' "$nqs" print -nr -- '=nqs '; pfn "$nqs"
printf '~nqs '; printf '<%s>\n' $* print -nr -- '~nqs '; pfn $*
qk="$@" qk="$@"
printf '= qk '; printf '<%s>\n' "$qk" print -nr -- '= qk '; pfn "$qk"
printf '~ qk '; printf '<%s>\n' "$@" print -nr -- '~ qk '; pfn "$@"
nqk=$@ nqk=$@
printf '=nqk '; printf '<%s>\n' "$nqk" print -nr -- '=nqk '; pfn "$nqk"
printf '~nqk '; printf '<%s>\n' $@ print -nr -- '~nqk '; pfn $@
expected-stdout: expected-stdout:
= qs <spacedivdedargument = qs <spacedivdedargument
here> here>
@ -3940,22 +3944,23 @@ name: IFS-subst-4-4p
description: description:
extended testsuite based on problem by mikeserv extended testsuite based on problem by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a; IFS= IFS=\ ; set -- $a; IFS=
unset v unset v
qs=${v:-"$*"} qs=${v:-"$*"}
printf '= qs '; printf '<%s>\n' "$qs" print -nr -- '= qs '; pfn "$qs"
printf '~ qs '; printf '<%s>\n' ${v:-"$*"} print -nr -- '~ qs '; pfn ${v:-"$*"}
nqs=${v:-$*} nqs=${v:-$*}
printf '=nqs '; printf '<%s>\n' "$nqs" print -nr -- '=nqs '; pfn "$nqs"
printf '~nqs '; printf '<%s>\n' ${v:-$*} print -nr -- '~nqs '; pfn ${v:-$*}
qk=${v:-"$@"} qk=${v:-"$@"}
printf '= qk '; printf '<%s>\n' "$qk" print -nr -- '= qk '; pfn "$qk"
printf '~ qk '; printf '<%s>\n' ${v:-"$@"} print -nr -- '~ qk '; pfn ${v:-"$@"}
nqk=${v:-$@} nqk=${v:-$@}
printf '=nqk '; printf '<%s>\n' "$nqk" print -nr -- '=nqk '; pfn "$nqk"
printf '~nqk '; printf '<%s>\n' ${v:-$@} print -nr -- '~nqk '; pfn ${v:-$@}
expected-stdout: expected-stdout:
= qs <spacedivdedargument = qs <spacedivdedargument
here> here>
@ -3984,21 +3989,22 @@ name: IFS-subst-4-5
description: description:
extended testsuite based on problem by mikeserv extended testsuite based on problem by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a; IFS=, IFS=\ ; set -- $a; IFS=,
qs="$*" qs="$*"
printf '= qs '; printf '<%s>\n' "$qs" print -nr -- '= qs '; pfn "$qs"
printf '~ qs '; printf '<%s>\n' "$*" print -nr -- '~ qs '; pfn "$*"
nqs=$* nqs=$*
printf '=nqs '; printf '<%s>\n' "$nqs" print -nr -- '=nqs '; pfn "$nqs"
printf '~nqs '; printf '<%s>\n' $* print -nr -- '~nqs '; pfn $*
qk="$@" qk="$@"
printf '= qk '; printf '<%s>\n' "$qk" print -nr -- '= qk '; pfn "$qk"
printf '~ qk '; printf '<%s>\n' "$@" print -nr -- '~ qk '; pfn "$@"
nqk=$@ nqk=$@
printf '=nqk '; printf '<%s>\n' "$nqk" print -nr -- '=nqk '; pfn "$nqk"
printf '~nqk '; printf '<%s>\n' $@ print -nr -- '~nqk '; pfn $@
expected-stdout: expected-stdout:
= qs <space,divded,argument = qs <space,divded,argument
here> here>
@ -4027,22 +4033,23 @@ name: IFS-subst-4-5p
description: description:
extended testsuite based on problem by mikeserv extended testsuite based on problem by mikeserv
stdin: stdin:
pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
a='space divded argument a='space divded argument
here' here'
IFS=\ ; set -- $a; IFS=, IFS=\ ; set -- $a; IFS=,
unset v unset v
qs=${v:-"$*"} qs=${v:-"$*"}
printf '= qs '; printf '<%s>\n' "$qs" print -nr -- '= qs '; pfn "$qs"
printf '~ qs '; printf '<%s>\n' ${v:-"$*"} print -nr -- '~ qs '; pfn ${v:-"$*"}
nqs=${v:-$*} nqs=${v:-$*}
printf '=nqs '; printf '<%s>\n' "$nqs" print -nr -- '=nqs '; pfn "$nqs"
printf '~nqs '; printf '<%s>\n' ${v:-$*} print -nr -- '~nqs '; pfn ${v:-$*}
qk=${v:-"$@"} qk=${v:-"$@"}
printf '= qk '; printf '<%s>\n' "$qk" print -nr -- '= qk '; pfn "$qk"
printf '~ qk '; printf '<%s>\n' ${v:-"$@"} print -nr -- '~ qk '; pfn ${v:-"$@"}
nqk=${v:-$@} nqk=${v:-$@}
printf '=nqk '; printf '<%s>\n' "$nqk" print -nr -- '=nqk '; pfn "$nqk"
printf '~nqk '; printf '<%s>\n' ${v:-$@} print -nr -- '~nqk '; pfn ${v:-$@}
expected-stdout: expected-stdout:
= qs <space,divded,argument = qs <space,divded,argument
here> here>
@ -4083,37 +4090,53 @@ description:
- b5ins, matching mkshs - b5ins, matching mkshs
!!WARNING!! more to come: http://austingroupbugs.net/view.php?id=888 !!WARNING!! more to come: http://austingroupbugs.net/view.php?id=888
stdin: stdin:
"$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- "" 2 ""; pfb $*; x=$*; pfn "$x"'
echo '=a1zns' echo '=a1zns'
"$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- "" 2 ""; pfb "$*"; x="$*"; pfn "$x"'
echo '=a2zqs' echo '=a2zqs'
"$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- "" 2 ""; pfb $@; x=$@; pfn "$x"'
echo '=a3zna' echo '=a3zna'
"$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- "" 2 ""; pfb "$@"; x="$@"; pfn "$x"'
echo '=a4zqa' echo '=a4zqa'
"$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- "" 2 ""; pfb $*; x=$*; pfn "$x"'
echo '=a5ins' echo '=a5ins'
"$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- "" 2 ""; pfb "$*"; x="$*"; pfn "$x"'
echo '=a6iqs' echo '=a6iqs'
"$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- "" 2 ""; pfb $@; x=$@; pfn "$x"'
echo '=a7ina' echo '=a7ina'
"$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- "" 2 ""; pfb "$@"; x="$@"; pfn "$x"'
echo '=a8iqa' echo '=a8iqa'
"$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- A B "" "" C; pfb $*; x=$*; pfn "$x"'
echo '=b1zns' echo '=b1zns'
"$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- A B "" "" C; pfb "$*"; x="$*"; pfn "$x"'
echo '=b2zqs' echo '=b2zqs'
"$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- A B "" "" C; pfb $@; x=$@; pfn "$x"'
echo '=b3zna' echo '=b3zna'
"$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=; set -- A B "" "" C; pfb "$@"; x="$@"; pfn "$x"'
echo '=b4zqa' echo '=b4zqa'
"$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- A B "" "" C; pfb $*; x=$*; pfn "$x"'
echo '=b5ins' echo '=b5ins'
"$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- A B "" "" C; pfb "$*"; x="$*"; pfn "$x"'
echo '=b6iqs' echo '=b6iqs'
"$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- A B "" "" C; pfb $@; x=$@; pfn "$x"'
echo '=b7ina' echo '=b7ina'
"$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"' "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
IFS=,; set -- A B "" "" C; pfb "$@"; x="$@"; pfn "$x"'
echo '=b8iqa' echo '=b8iqa'
expected-stdout: expected-stdout:
[2] [2]
@ -4193,7 +4216,7 @@ name: IFS-subst-6
description: description:
Regression wrt. vector expansion in trim Regression wrt. vector expansion in trim
stdin: stdin:
showargs() { for x in "$@"; do echo -n "<$x> "; done; echo .; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS= IFS=
x=abc x=abc
set -- a b set -- a b
@ -4205,7 +4228,7 @@ name: IFS-subst-7
description: description:
ksh93 bug wrt. vector expansion in trim ksh93 bug wrt. vector expansion in trim
stdin: stdin:
showargs() { for x in "$@"; do echo -n "<$x> "; done; echo .; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS="*" IFS="*"
a=abcd a=abcd
set -- '' c set -- '' c
@ -4228,7 +4251,7 @@ description:
stdin: stdin:
${ZSH_VERSION+false} || emulate sh ${ZSH_VERSION+false} || emulate sh
${BASH_VERSION+set -o posix} ${BASH_VERSION+set -o posix}
showargs() { for x in "$@"; do echo -n "<$x> "; done; echo .; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
IFS=0 IFS=0
showargs $((1230456)) showargs $((1230456))
expected-stdout: expected-stdout:
@ -8342,13 +8365,13 @@ name: varexpand-null-3
description: description:
Ensure concatenating behaviour matches other shells Ensure concatenating behaviour matches other shells
stdin: stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
x=; showargs 1 "$x"$@ x=; showargs 1 "$x"$@
set A; showargs 2 "${@:+}" set A; showargs 2 "${@:+}"
expected-fail: yes expected-fail: yes
expected-stdout: expected-stdout:
<1> <> <1> <> .
<2> <> <2> <> .
--- ---
name: print-funny-chars name: print-funny-chars
description: description:

4
misc.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.38 2013/11/28 10:33:37 sobrado Exp $ */ /* $OpenBSD: misc.c,v 1.39 2015/01/16 06:39:32 deraadt Exp $ */
/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
/*- /*-
@ -30,7 +30,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.223 2015/01/02 13:21:28 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.224 2015/01/25 15:23:41 tg Exp $");
#define KSH_CHVT_FLAG #define KSH_CHVT_FLAG
#ifdef MKSH_SMALL #ifdef MKSH_SMALL

20
mksh.1
View File

@ -1,8 +1,8 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.347 2014/12/18 20:51:12 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.348 2015/01/25 15:23:42 tg Exp $
.\" $OpenBSD: ksh.1,v 1.155 2014/12/09 15:37:13 schwarze Exp $ .\" $OpenBSD: ksh.1,v 1.156 2015/01/16 15:32:32 schwarze Exp $
.\"- .\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
.\" 2010, 2011, 2012, 2013, 2014 .\" 2010, 2011, 2012, 2013, 2014, 2015
.\" Thorsten Glaser <tg@mirbsd.org> .\" Thorsten Glaser <tg@mirbsd.org>
.\" .\"
.\" Provided that these terms and disclaimer and all copyright notices .\" Provided that these terms and disclaimer and all copyright notices
@ -74,7 +74,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to .\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always. .\" use our own definition. And .Dd must come *first*, always.
.\" .\"
.Dd $Mdocdate: December 18 2014 $ .Dd $Mdocdate: January 25 2015 $
.\" .\"
.\" Check which macro package we use, and do other -mdoc setup. .\" Check which macro package we use, and do other -mdoc setup.
.\" .\"
@ -673,11 +673,11 @@ are reserved words, not meta-characters.
.It Xo case Ar word No in .It Xo case Ar word No in
.Oo Op \&( .Oo Op \&(
.Ar pattern .Ar pattern
.Op \*(Ba Ar pat .Op \*(Ba Ar pattern
.No ... Ns ) .No ... Ns )
.Ar list .Ar list
.Op ;; \*(Ba ;&\& \*(Ba ;\*(Ba\ \& .Ic terminator
.Oc ... esac .Oc No ... esac
.Xc .Xc
The The
.Ic case .Ic case
@ -707,9 +707,11 @@ For historical reasons, open and close braces may be used instead of
and and
.Ic esac .Ic esac
e.g.\& e.g.\&
.Ic case $foo { *) echo bar;; } . .Ic case $foo { *) echo bar ;; } .
.Pp .Pp
The list terminators are: The list
.Ic terminator Ns s
are:
.Bl -tag -width 4n .Bl -tag -width 4n
.It Ql ;; .It Ql ;;
Terminate after the list. Terminate after the list.

8
sh.h
View File

@ -169,9 +169,9 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.708 2015/01/04 21:08:10 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.709 2015/01/25 15:23:43 tg Exp $");
#endif #endif
#define MKSH_VERSION "R50 2015/01/04" #define MKSH_VERSION "R50 2015/01/25"
/* arithmetic types: C implementation */ /* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES #if !HAVE_CAN_INTTYPES
@ -312,9 +312,13 @@ struct rusage {
#undef PATH_MAX #undef PATH_MAX
#else #else
#ifndef PATH_MAX #ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024 #define PATH_MAX 1024
#endif #endif
#endif #endif
#endif
#ifndef SIZE_MAX #ifndef SIZE_MAX
#ifdef SIZE_T_MAX #ifdef SIZE_T_MAX
#define SIZE_MAX SIZE_T_MAX #define SIZE_MAX SIZE_T_MAX