zsh-workers
 help / color / mirror / code / Atom feed
* Bugs in 3.1.2
@ 1997-06-04 18:52 Bernd Eggink
  1997-06-04 19:44 ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Eggink @ 1997-06-04 18:52 UTC (permalink / raw)
  To: zsh-workers

(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@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bugs in 3.1.2
  1997-06-04 18:52 Bugs in 3.1.2 Bernd Eggink
@ 1997-06-04 19:44 ` Zoltan T. Hidvegi
  1997-06-05  7:22   ` Bernd Eggink
  0 siblings, 1 reply; 3+ messages in thread
From: Zoltan T. Hidvegi @ 1997-06-04 19:44 UTC (permalink / raw)
  To: Bernd Eggink; +Cc: zsh-workers

Bernd Eggink wrote:
> 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

I did check this before the release and ksh93, pdksh and bash all have the
same behaviour as zsh.  So four completely different shell with different
source base has the same behaviour.  I'm not convinced that this has to be
changed.

Zoltan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bugs in 3.1.2
  1997-06-04 19:44 ` Zoltan T. Hidvegi
@ 1997-06-05  7:22   ` Bernd Eggink
  0 siblings, 0 replies; 3+ messages in thread
From: Bernd Eggink @ 1997-06-05  7:22 UTC (permalink / raw)
  To:  (Zoltan T. Hidvegi); +Cc: zsh-workers

(Zoltan T. Hidvegi) wrote:
> 
> Bernd Eggink wrote:
> > 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
> 
> I did check this before the release and ksh93, pdksh and bash all have the
> same behaviour as zsh.  So four completely different shell with different
> source base has the same behaviour. 

I know, but as I told you some time ago, David Korn himself considers
this behaviour a bug... And why not do better than other shells?

Bernd

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-06-05  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-04 18:52 Bugs in 3.1.2 Bernd Eggink
1997-06-04 19:44 ` Zoltan T. Hidvegi
1997-06-05  7:22   ` Bernd Eggink

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).