Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] var=$* and var=$@ create array with SHWORDSPLIT and null or unset IFS



On Feb 20, 10:58am, Bart Schaefer wrote:
}
} >--- null IFS, native splitting ---
} >> var=$@
} >[one two three four]
} >> var=$*
} >[onetwo threefour]
} >> var="$@"
} >[one two three four]
} >> var="$*"
} >[onetwo threefour]
} 
} Joining the array for assignment is forced by prefork() passing
} PREFORK_SINGLE down to paramsubst().  Joining is supposed to be done on
} the first character of $IFS in this case.  When IFS is null (as opposed
} to unset), this causes both $@ and $* to join on empty string.
} 
} Where is the space supposed to come from when joining $@ here?

Thanks to Chet Ramey for pointing me at
http://austingroupbugs.net/view.php?id=888

Which says (very last block of examples) that var=$@ and var="$@" and
a whole slew of their variations, have unspecified behavior.

Consequently I'm going to take the position that zsh is allowed to join
these with empty string rather than pulling a field separator out of
its proverbial hat, and I will tweak 40565 appropriately and commit.



Messages sorted by: Reverse Date, Date, Thread, Author