cfengine-develop
[Top][All Lists]
Advanced

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

[Cfengine-develop] Help


From: mark
Subject: [Cfengine-develop] Help
Date: Wed, 23 Apr 2003 08:17:10 +0200 (MEST)

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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

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