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

Bugs in 3.1.2



(I'm re-sending this because my first mail seems to have got lost).

1. There's still a minor bug in 'getopts' in 3.1.2. If the options
string contains a ':', a user supplied option ':' will be accepted.
Example:

  # tst
  while getopts ab:c opt
  do; print "option is $opt"; done
    
  tst -:        # prints 'option is :'

The easiest way to avoid this is to declare the option character ':' 
illegal. Here is a patch for "builtin.c":


2393a2394
>       lenoptstr--;
2421c2422
<     if (i == lenoptstr) {
---
>     if (i == lenoptstr || *opch == ':') {


2. 'select' still doesn't check its input correctly. As 'atoi' is used,
any string starting with a valid number is accepted. IMHO it would be
better to use 'strtol' instead and check the delimiting character. This
patch for "loop.c" does it:

123c123
<     char *str, *s;
---
>     char *str, *s, *estr;
126c126
<     int i;
---
>     long i;
172,173c172,173
<       i = atoi(str);
<       if (!i)
---
>       i = strtol(str, &estr, 10);
>       if (!i || *estr)



-- 
Bernd Eggink
Regionales Rechenzentrum der Universitaet Hamburg
eggink@xxxxxxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html



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