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

One last _values / compvalues nit, and a nasty crash bug



First the nit:

I don't expect anyone to leap to do anything about this, but now that we
have both -S and -s (and it's too bad their meanings aren't reversed as
the string given to -s is the one that has to be passed to compadd -S, but
it's too late for that now) the issue arises of what happens when you pass
the same string to both.

E.g.:

zsh% _tv() { _values -S : -s : test 'a: :(foo)' b }
zsh% compedef _tv :
zsh% : a<TAB>
zsh% : a:<TAB>
zsh% : a:b 

At this point, the thing that comes after `a:' should have been considered
an argument, not a new value.  If the argument to `a' is required rather
than optional, there's no reason the same separator can't be used both
between the value and its argument, and between the argument and the next
value.

Now the bug -- press TAB three times after `: a' and get a crash:

schaefer<501> function _tv { _values -S '' -s : 'a: :(foo)' b }
schaefer<502> compdef _tv :
schaefer<503> function _tv { _values -S '' -s : test 'a: :(foo)' b }
schaefer<504> : afoo:afoo:BUG: attempt to free more than allocated.
_values:149: command not found: 0R^O^H\M-^?\M-^?\M-^?\M-^?@T^O^H\M-^?\M-^?\M-^?\M-^?pR^O^H\M-^?\M-^?\M-^?\M-^?\M-@S^O^H\M-^?\M-^?\M-^?\M-^?\M-pP^O^H\M-^?\M-^?\M-^?\M-^?ws
zsh: segmentation fault (core dumped)  zsh-4.0.1-pre-4

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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