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

Re: read broken in beta21



> It appears that the changes to bin_read in beta21 have introduced a
> bug.  Trailing non-whitespace IFS characters on the input line are
> appended to the last parameter being set, instead of removed.  This
> change has broken a script of mine.  Or does POSIX require this?  sh
> matches zsh's previous behaviour.

What is sh?  On Linux, sh is bash which matches zsh's new behaviour.  Other
sh's.  Here is what POSIX says:

 The line shall be split into fields (see the definition in 3.1.3) as in
 the shell (see 3.6.5); the first field shall be assigned to the first
 variable var, the second field to the second variable var, etc.  If there
 are fewer var operands specified than there are fields, the leftover
 fields and their intervening separators shall be assigned to the last
 var. If there are fewer fields than vars, the remaining vars shall be set
 to empty strings.

So it is clear that the `intervening separators' should be assigned to the
last parameter.  A non-whitespace IFS character is always a separator so it
should not be removed.  bash and pdksh behaves as zsh while ksh93 removes
training non-whitespace IFS characters (which is wrong if I interpret POSIX
correctly).  This also means that trailing IFS-whitespaces should be
removed as these are not and intervening separarators.

Zoltan




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