pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/51142: pdksh has occasional issues with empty 'for' loops



The following reply was made to PR pkg/51142; it has been noted by GNATS.

From: Richard PALO <richard.palo%free.fr@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/51142: pdksh has occasional issues with empty 'for' loops
Date: Mon, 16 May 2016 09:10:17 +0200

 Le 16/05/16 06:55, Richard PALO a écrit :
 >  Testing again bash and ksh93, ommiting the "in" gives 'dummy' as with pdksh so it does
 >  look like pdksh is the culprit here.
 >  
 
 Although by no means specialist in shell processing, this did seem to come down to around
 the following in the wordlist() function found in syn.c
 
 Prior to this patch, the result was the same whether "in" was specified with a null set of options or not.
 
 > diff --git a/shells/pdksh/files/syn.c b/shells/pdksh/files/syn.c
 > index d3bce2e..3b19d0a 100644
 > --- a/shells/pdksh/files/syn.c
 > +++ b/shells/pdksh/files/syn.c
 > @@ -609,13 +609,8 @@ wordlist()
 >                 XPput(args, yylval.cp);
 >         if (c != '\n' && c != ';')
 >                 syntaxerr((char *) 0);
 > -       if (XPsize(args) == 0) {
 > -               XPfree(args);
 > -               return NULL;
 > -       } else {
 > -               XPput(args, NULL);
 > -               return (char **) XPclose(args);
 > -       }
 > +       XPput(args, NULL);
 > +       return (char **) XPclose(args);
 >  }
 >  
 >  /*
 
 before:
 > richard@omnis:/home/richard/src/pkgsrc/shells/pdksh$ /opt/local/bin/pdksh 
 > $ set dummy 
 > $ for i in ; do echo $i; done
 > dummy
 > $ for i ; do echo $i; done
 > dummy
 
 after:
 > richard@omnis:/tmp/pkgsrc/shells/pdksh/work/.destdir/opt/local/bin$ ./pdksh 
 > $ set dummy
 > $ for i in ; do echo $i; done
 > $ for i ; do echo $i; done
 > dummy
 
 
 does this look reasonable?
 
 -- 
 Richard PALO
 


Home | Main Index | Thread Index | Old Index