I'm not convinced this is a bug (although please check my reasoning);
the code is still present in ast-ksh.2012-09-11 upstream source but has
moved to name.c around line 1201.

That (horrible) block of  code is:
              1            if((nq = (*fp->disc->createf)(np,cp+1,flags,fp)) == 
np)
              2                                 {
              3                                          add = NV_ADD;
              4                                         shp->last_table = 0;
              5                                          break;
               6                                 }
               7                                 else if(np=nq)
               8                                 {
                9                                        if((c = 
*(sp=cp=dp->last=fp->last))==0)
              10                                          {
              11                                                 
if(nv_isarray(np) && sp[-1]!=']')
              12                                                        
nv_putsub(np,NIL(char*),ARRAY_UNDEF);
              13                                               return(np);
              14                                          }
               15                                 }

(all 3 or 4 levels down in the middle of a do/while loop)

My reading of that is that (using my line numbering I added above)
   (1) Assigning nq a new value from the call to *createf, and if it matches np 
execute the block lines 3-5
   (7) If the new nq didn't match np, then we get to the if (np=nq) which is 
the line in question, they can't
        be intending to compare np with nq because that's what (1) just did, so 
I think they really intend to do an
        assignment to np, which possibly gets returned at (13)
       but more importantly the 'np is set up for the next iteration around the 
do/while loop.

Yeuch!

If you're not sure you might try reporting upstream at
http://www.kornshell.com/

Dave

** Changed in: ksh (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/218837

Title:
  Assigning instead of Comparing

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ksh/+bug/218837/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to