cfengine-develop
[Top][All Lists]
Advanced

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

Re: [Cfengine-develop] Help


From: Mark Burgess
Subject: Re: [Cfengine-develop] Help
Date: Wed, 23 Apr 2003 16:12:45 +0200 (MEST)


What bothers me is why we have to go through the whole tidy list here.
And why, at some point the tidy list is deleted without properly
terminating the loop...

M


On 23 Apr, Bas van der Vlies wrote:
> Mark,
> 
>   you can clean up the code to:
> 
>    for (tlp = tp->tidylist; tlp != NULL; tlp=tlp->next)
>       {
>       if (IsExcluded(tlp->classes))
>          {
>          continue;
>          }
>       }
> 
>    basename[0] = '\0';
>    ...
> 
>  The code of we can remove a directory does not work because
>  tlp->rmdirs is char and NOT a boolean. So the statements inside the
>  if loop are never executed and as you say the check and deletion is
>  somewhere else!
> 
>  Hope this Helps
> 
> On Wed, 2003-04-23 at 08:17, address@hidden wrote:
>> I need to borrow someone's time in looking at a bug report.
>> It has to do with tidy. Now, when I look at the code in
>> src/do.c for TidyFiles, I do not understand it at all.
>> 
>> Can anyone justify to me this loop? Or tell me what I was
>> thinking? It doesn't make any sense to me anymore. My guess
>> is that it is the result of old things that can now be
>> changed. The tidylist loop happens way down in the recursive
>> tidy functions, so it does not need to be here also?? It seems
>> to me that we only need to know whether at least one of the 
>> patterns in the list is "class activated" to make the search
>> worth starting...am I going crazy?
>> 
>> 
>>    for (tlp = tp->tidylist; tlp != NULL; tlp=tlp->next)
>>       {
>>       if (IsExcluded(tlp->classes))
>>          {
>>          continue;
>>          }
>> 
>>       Verbose("Directory %s\n",tp->path);
>>       strcpy(VBUFF,tp->path);
>>       AddSlash(VBUFF);
>>       strcat(VBUFF,tlp->pattern);
>> 
>>       if (stat(VBUFF,&statbuf) != -1)   /* not lstat - could confuse
>>       user */
>>          {
>>          if (S_ISDIR(statbuf.st_mode))
>>             {
>>          if (! tlp->rmdirs)          /* Are we allowed to rm empty dirs? */
>>             {
>>                Verbose("%s: will not delete directories (matching
>> %s)!\n",VPREFIX,tlp->pattern);              Verbose("%s: Applies to
>> %s\n",VPREFIX,VBUFF);
>>                DeleteTidyList(tp->tidylist);
>>             tp->tidylist = NULL;
>>                continue;
>>             }
>>             }
>>          }
>> 
>>       basename[0] = '\0';
>>       ExpandWildCardsAndDo(tp->path,basename,TidyWrapper,tp);
>>       /* Cancel entire pattern list for this path to avoid
>>       rescheduling */ DeleteTidyList(tp->tidylist);
>>       tp->tidylist = NULL;
>>       }
>> 
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Work: +47 22453272            Email:  address@hidden
>> Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 
>> 
>> 
>> _______________________________________________
>> Cfengine-develop mailing list
>> address@hidden
>> http://mail.nongnu.org/mailman/listinfo/cfengine-develop

-- 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]