On Sat, 20 May 2006, Otto Moerbeek wrote:
> On Sat, 20 May 2006, jared r r spiegel wrote:
>
> > On Sat, May 20, 2006 at 11:28:26AM -0400, jared r r spiegel wrote:
> > >
> > > i have half a mind that says otto@/kili@/ckuthe will come down
> > > and cluestick me about why what i am seeing is expected behaviour,
> > > but the other half expects this to be not what should be happening.
>
> this looks like a bug,
Actually, it looks like two bugs. One is typeset -i related, the other
occurs if you do:
[EMAIL PROTECTED]:1]$ A=a
[EMAIL PROTECTED]:2]$ A[1]=b
[EMAIL PROTECTED]:3]$ set
A[593830152]=a
A[1]=b
...
The diff below seems to fix the latter; I'm still investigating the
typeset -i stuff.
-Otto
Index: var.c
===================================================================
RCS file: /cvs/src/bin/ksh/var.c,v
retrieving revision 1.29
diff -u -p -r1.29 var.c
--- var.c 13 Mar 2006 08:21:37 -0000 1.29
+++ var.c 20 May 2006 20:29:02 -0000
@@ -1107,12 +1107,10 @@ arraysearch(struct tbl *vp, int val)
size_t namelen = strlen(vp->name) + 1;
vp->flag |= ARRAY|DEFINED;
-
+ vp->index = 0;
/* The table entry is always [0] */
- if (val == 0) {
- vp->index = 0;
+ if (val == 0)
return vp;
- }
prev = vp;
curr = vp->u.array;
while (curr && curr->index < val) {