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

Obscure UTF-8 bug in parameter expansion?



(See zsh-users/9389 for background.)

Using the latest zsh from CVS, I was just trying out the command

	zargs -- sur pur -- echo {} -foo bar

and zargs went into an infinite loop.  I found this rather baffling,
as it had been pretty thoroughly tested, so I ran it with `set -x' and
encountered this:

[...]
: zargs:233; s=20480 
: zargs:234; l=ÿ 
[...]

The assignment to `l' there should always be a number, unless one has
abused the --max-lines option.  The actual declaration/assignment is:

local -a opts eof n s l P i
# An intervening zparseopts call may assign to l or may not
l=${${${l##*-(l|L|-max-lines(=|))}[-1]}:-${${l[1]:+1}:-$ARGC}}

So apparently when `l' should be the empty array (as it was declared on
line 68) it is instead the garbage string y-with-an-umlaut.  I'm pretty
sure this did not occur before --enable-multibyte became the default.
However, recompiling with --disable-multibyte doesn't change anything,
so the problem may be in code that changed independent of the multibyte
support.



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