[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Cfengine-develop] Help
From: |
Bas van der Vlies |
Subject: |
Re: [Cfengine-develop] Help |
Date: |
24 Apr 2003 09:24:05 +0200 |
The only explanation that i have is that the code comes from the 'home'
check. It does not make sense to have this code here because the checks
are also some where else. I think the code must be:
(I have made the changes and the tidy still works as before)
Banner("Tidying by directory");
for (tp = VTIDY; tp != NULL; tp=tp->next)
{
if (strncmp(tp->path,"home",4)==0)
{
for (tlp = tp->tidylist; tlp != NULL; tlp=tlp->next)
{
if (!IsExcluded(tlp->classes))
{
homesearch = 1;
break;
}
}
continue;
}
basename[0] = '\0';
ExpandWildCardsAndDo(tp->path,basename,TidyWrapper,tp);
}
On Wed, 2003-04-23 at 16:12, Mark Burgess wrote:
> 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
--
() ascii ribbon campaign - against html e-mail
/\ - against microsoft attachments
********************************************************************
* *
* Bas van der Vlies e-mail: address@hidden *
* SARA - Academic Computing Services phone: +31 20 592 8012 *
* Kruislaan 415 fax: +31 20 6683167 *
* 1098 SJ Amsterdam *
* *
********************************************************************