Preliminary fix committed, plus some test coverage. This is a real
problem, raising priority.
Fix needs to be extended; CVS HEAD needs to be tested better.
** Changed in: mksh
Importance: Low = High
** Changed in: mksh
Status: New = In Progress
** Changed in: mksh
Assignee: (unassigned) = Thorsten Glaser (mirabilos)
--
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1381993
Title:
more fun with $*
Status in The MirBSD Korn Shell:
In Progress
Bug description:
From: Stephane Chazelas stephane.chaze...@gmail.com
BTW, it looks like there's a bug in mksh:
tglase@tglase:~ $ bash -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a b | sed
-n l
abc$
tglase@tglase:~ $ ./dash -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a b |
sed -n l
c$
tglase@tglase:~ $ ksh93 -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a b | sed
-n l
c$
tglase@tglase:~ $ lksh -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a b | sed
-n l
\a\300a$
abc$
tglase@tglase:~ $ mksh -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a b | sed
-n l
\a\300a$
abc$
tglase@tglase:~ $ pdksh-5.2.14 -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a
b | sed -n l
abc$
tglase@tglase:~ $ mksh -o sh -c 'IFS=; x=abc; printf %s\n ${x#$*}' x a b
| sed -n l
a$
abc$
The dash versions I have access to give the expected output
(same as your ksh93).
bash and pdksh join the arguments with spaces. And there's
nothing in POSIX that allows them to do that.
But:
ksh93 has some other interesting bugs:
tglase@tglase:~ $ bash -c 'IFS=*; a=abcd; printf %s\n $* ${a##$*}'
sh '' c
*c
abcd
tglase@tglase:~ $ ./dash -c 'IFS=*; a=abcd; printf %s\n $*
${a##$*}' sh '' c
*c
abcd
tglase@tglase:~ $ ksh93 -c 'IFS=*; a=abcd; printf %s\n $* ${a##$*}'
sh '' c
*c
d
tglase@tglase:~ $ lksh -c 'IFS=*; a=abcd; printf %s\n $* ${a##$*}'
sh '' c
*c
abcd
tglase@tglase:~ $ mksh -c 'IFS=*; a=abcd; printf %s\n $* ${a##$*}'
sh '' c
*c
abcd
tglase@tglase:~ $ pdksh-5.2.14 -c 'IFS=*; a=abcd; printf %s\n $*
${a##$*}' sh '' c
*c
abcd
tl;dr: Fix the first and keep the second as-is.
And they don't say how those arrays are to be cast to scalars
when not in list context since they don't specify arrays in the
first place.
The non-list contexts include
a=$*
${a#$*}
case x in
$a) ...;;
$a) ...
esac
${a#$*} # beware quotes also serve to cancel globs there
$(( $* ))
...
Interesting use for the asn subst.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1381993/+subscriptions