2014-10-07 15:03:05 +0200, Thorsten Glaser: > On Sat, 4 Oct 2014, Russ Allbery wrote: > > > >> If we were to decide that #309415 should be fixed in policy (and hence > > >> posh), then it should be done by requiring support for the obsolescent > > The problems with posh and dash are also the sheer number of bugs > in corner cases, which the more actively developed shells fix. > > posh inherited all bugs from pdksh which I fixed in mksh, partially > by rewriting the parser… so it had to be restarted from newer code. > > dash, well, just ugh. > > tglase@tglase:~ $ cat x > a='space divded argument > here' > IFS=\ ; set -- $a > IFS= ; q="$*" ; nq=$* > printf '<%s>\n' "$*" $* "$q" "$nq" > [ "$q" = "$nq" ] && echo =true || echo =false > tglase@tglase:~ $ dash x > <spacedivdedargument > here> > <spacedivdedargument > here> > <spacedivdedargument > here> > <spacedivdedargument > here> > =true
That's expected behaviour to me, and the intuitive continuation of the Bourne shell. In the Bourne shell, the * and @ variable were variables whose content were the concatenation of the positional arguments with " " in between. And, as a special case "$@" in list contexts didn't undergo normal expansion, but instead expended to the list of positional parameters as separate words. $*, $@, "$*" were not special in any way. They just underwent the same rules as other variables. Only "$@" was. That's why for instance: bourne-sh -c 'set a b; IFS=; printf "<%s>\n" $*' <a b> dash is the same except that $* and $@ are the concatenation of the positional parameters with the first character of IFS. ksh introduced its bogus array feature and modified the meaning of $* and $@ which are no longer normal variables (and in my opinion make a lot less sense than the ash behaviour). Now all shells have varying behaviours for corner cases of those which means that for portability, you should only use $* and $@ quoted and only use "$@" in list contexts. The behaviour for a=$@ of ${a#$*} or ${a#$@} varies from shell to shell. -- Stephane -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20141013204233.gb6...@chaz.gmail.com