bug-cfengine
[Top][All Lists]
Advanced

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

Re: Bug in editfiles defineclasses at 1.6.2


From: Mark . Burgess
Subject: Re: Bug in editfiles defineclasses at 1.6.2
Date: Sat, 10 Mar 2001 14:15:03 +0100 (MET)

Thank you for your patch!

regards,
Mark


On 10 Mar, Ian Spare wrote:
> 
> Ok, here's a patch:
> 
> *** edittools.c       Sat Mar 10 13:46:30 2001


> --- edittools.c.new   Sat Mar 10 13:46:15 2001
> ***************
> *** 1451,1456 ****
> --- 1451,1460 ----
>      {
>      for (ep = list->actions; ep != NULL; ep=ep->next)
>         {
> +       if (IsExcluded(ep->classes))
> +          {
> +          continue;
> +          }
>         if (ep->code == DefineClasses)
>        {
>        break;
> ***************
> *** 1461,1466 ****
> --- 1465,1474 ----
>      {
>      for (ep = list->actions; ep != NULL; ep=ep->next)
>         {
> +       if (IsExcluded(ep->classes))
> +          {
> +          continue;
> +          }
>         if (ep->code == ElseDefineClasses)
>        {
>        break;
> 
> 
> 
> -----Original Message-----
> From: Ian Spare 
> Sent: Saturday, March 10, 2001 12:58 PM
> To: Ian Spare; 'address@hidden'
> Subject: RE: Bug in editfiles defineclasses at 1.6.2
> 
> 
> 
> 
> OK, got it :-) There is a bug in edittools.c in AddEditfileClasses, I'll
> post a patch in a couple of hours when I've finished testing.
> 
> Ian
> 
> -----Original Message-----
> From: Ian Spare 
> Sent: Friday, March 09, 2001 4:00 PM
> To: 'address@hidden'
> Subject: Bug in editfiles defineclasses at 1.6.2
> 
> 
> 
> I'm having some problems with editfiles, it's probably best explained with
> an example:
> 
> control:
>    any::
>       actionsequence = ( 
>                         editfiles.pass1
>                         shellcommands.pass1
>                         editfiles.pass2
>                         shellcommands.pass2
>                         )
> editfiles:
> 
>    any.pass1::
>    { /tmp/test.file
>        AutoCreate
>        EmptyEntireFilePlease
>        InsertFile "/etc/motd"
>        AppendIfNoSuchLine "# pass1 on the editfiles"
>        DefineClasses "pass1_done"
>    }
> 
>   pass2.pass1_done::
>   { /tmp/test.file
>               AppendIfNoSuchLine "# pass2 on the editfiles"
>               DefineClasses "pass2_done"
>   }
> 
> 
> shellcommands:
> 
> 
>       pass1::
>               "/bin/echo pass1 shell >> /tmp/test.file "
> 
>       pass2.pass2_done::
>               "/bin/echo pass2 shell SUCCESS  >> /tmp/test.file "
> 
> So, I'm expecting that on the pass2 of shellcommands I get the
> "pass2.pass2_done" run. In fact, it doesn't run. The debug output seems to
> show the problem, basically the second pass through of editfiles that should
> have defined the pass2_done class actually tried to redefine the class
> pass1_done incorrectly. Has anyone else seen this ? (I get the exact same on
> 1.6.3)
> 
> Reference time set to Fri Mar  9 15:51:40 2001
> 
> AddClassToHeap(Friday)
> AddClassToHeap(Hr15)
> AddClassToHeap(Min51)
> AddClassToHeap(Min50_55)
> AddClassToHeap(Day9)
> AddClassToHeap(March)
> AddClassToHeap(Yr2001)
> WildMatch(-,linux)
> WildMatch(-,linux)
> WildMatch(sunos,linux)
> WildMatch(ultrix,linux)
> WildMatch(hp-ux,linux)
> WildMatch(hp-ux,linux)
> WildMatch(hp-ux,linux)
> WildMatch(aix,linux)
> WildMatch(linux,linux)
> WildMatch(*,i686)
> WildMatch(*,2.2.16-22)
> AddClassToHeap(linux)
> AddClassToHeap(destroy_eur_sas_com)
> AddClassToHeap(destroy_eur_sas_com)
> AddClassToHeap(eur_sas_com)
> Truncating fully qualified hostname destroy.eur.sas.com to destroy
> AddClassToHeap(destroy)
> GNU Configuration Engine - 
> 1.6.2
> Free Software Foundation 1995-2000
> Donated by Mark Burgess, Faculty of Engineering,
> Oslo University College, 0254 Oslo, Norway
> 
> ------------------------------------------------------------------------
> 
> Host name is: destroy.eur.sas.com
> Operating System Type is linux
> Operating System Release is 2.2.16-22
> Architecture = i686
> 
> 
> Using internal soft-class linux for host destroy.eur.sas.com
> 
> The time is now Fri Mar  9 15:51:40 2001
> 
> 
> ------------------------------------------------------------------------
> 
> AddClassToHeap(32_bit)
> Additional hard class defined as: 32_bit
> AddClassToHeap(linux_2_2_16_22)
> AddClassToHeap(i686)
> Additional hard class defined as: linux_2_2_16_22
> AddClassToHeap(linux_i686)
> Additional hard class defined as: linux_i686
> AddClassToHeap(linux_i686_2_2_16_22)
> Additional hard class defined as: linux_i686_2_2_16_22
> AddClassToHeap(linux_i686_2_2_16_22__1_Tue_Aug_22_16_49_06_EDT_2000)
> Additional hard class defined as:
> linux_i686_2_2_16_22__1_Tue_Aug_22_16_49_06_EDT_2000
> AddClassToHeap(linux_gnu)
> 
> GNU autoconf class from compile time: linux-gnu
> 
>   Careful with this - it might not be correct at run time if you have
>   several OS versions with binary compatibilty!
> 
> Address given by nameserver: 130.96.14.218
> AddClassToHeap(130_96_14)
> AddClassToHeap(130_96_14_218)
> Found: 2 interfaces
> Interface 1: lo
> Interface 2: eth0
> Adding hostip 130.96.14.218..
> AddClassToHeap(130_96_14_218)
> Adding hostname destroy.eur.sas.com..
> AddClassToHeap(destroy_eur_sas_com)
> destroy.eur.sas.com: No preconfiguration file
> BEGIN PARSING cf.test
>    (No actions pending in )
> 
> BEGIN NEW ACTION Control Defintions:
> Class:: any::
>    (No actions pending in Control Defintions:)
> HandleClass(any)
> Simple identifier or class = (any)
> HandleId(actionsequence)
> LEFTBRACK
> HandleItem(editfiles.pass1)
> simple item = (editfiles.pass1)
> 
> (Action is control, storing variable [actionsequence=editfiles.pass1])
> Installing item (editfiles.pass1) in the action sequence list
> HandleItem(shellcommands.pass1)
> simple item = (shellcommands.pass1)
> 
> (Action is control, storing variable [actionsequence=shellcommands.pass1])
> Installing item (shellcommands.pass1) in the action sequence list
> HandleItem(editfiles.pass2)
> simple item = (editfiles.pass2)
> 
> (Action is control, storing variable [actionsequence=editfiles.pass2])
> Installing item (editfiles.pass2) in the action sequence list
> HandleItem(shellcommands.pass2)
> simple item = (shellcommands.pass2)
> 
> (Action is control, storing variable [actionsequence=shellcommands.pass2])
> Installing item (shellcommands.pass2) in the action sequence list
> RIGHTBRACK
>    (No actions pending in Control Defintions:)
> 
> BEGIN NEW ACTION Edit Simple Text File:
> Class:: any.pass1::
>    (No actions pending in Edit Simple Text File:)
> HandleClass(any.pass1)
> Compound class = (any.pass1) with 2 members
> LBRACE
>    (No actions pending in Edit Simple Text File:)
> InitializeAction()
> path = (/tmp/test.file)
> Handling Edit of /tmp/test.file, action [AutoCreate] with no data
> InstallEditFile(/tmp/test.file,AutoCreate,-)
> Handling Edit of /tmp/test.file, action [EmptyEntireFilePlease] with no data
> HandleItem(InsertFile)
> simple item = (InsertFile)
> Handling Edit of /tmp/test.file, action [InsertFile] with data </etc/motd>
> HandleItem(AppendIfNoSuchLine)
> simple item = (AppendIfNoSuchLine)
> Handling Edit of /tmp/test.file, action [AppendIfNoSuchLine] with data <#
> pass1 on the editfiles>
> HandleItem(DefineClasses)
> simple item = (DefineClasses)
> Handling Edit of /tmp/test.file, action [DefineClasses] with data
> <pass1_done>
> AddInstallable(pass1_done)
> RBRACE
> Class:: pass2.pass1_done::
> 
>    [BEGIN InstallPending Edit Simple Text File:
>    END InstallPending]
> 
> HandleClass(pass2.pass1_done)
> Compound class = (pass2.pass1_done) with 2 members
> LBRACE
>    (No actions pending in Edit Simple Text File:)
> InitializeAction()
> path = (/tmp/test.file)
> HandleItem(AppendIfNoSuchLine)
> simple item = (AppendIfNoSuchLine)
> Handling Edit of /tmp/test.file, action [AppendIfNoSuchLine] with data <#
> pass2 on the editfiles>
> HandleItem(DefineClasses)
> simple item = (DefineClasses)
> Handling Edit of /tmp/test.file, action [DefineClasses] with data
> <pass2_done>
> AddInstallable(pass2_done)
> RBRACE
> 
>    [BEGIN InstallPending Edit Simple Text File:
>    END InstallPending]
> 
> 
> BEGIN NEW ACTION User Shell Commands:
> InitializeAction()
> Class:: pass1::
>    (No actions pending in User Shell Commands:)
> HandleClass(pass1)
> Simple identifier or class = (pass1)
>    (No actions pending in User Shell Commands:)
> InitializeAction()
> path = (/bin/echo pass1 shell >> /tmp/test.file )
> Class:: pass2.pass2_done::
> 
>    [BEGIN InstallPending User Shell Commands:
> Installing item (/bin/echo pass1 shell >> /tmp/test.file ) in the script
> list
> Build2DListFromVarstring(/bin/echo pass1 shell >> /tmp/test.file ,sep= )
> SplitVarstring(/bin/echo pass1 shell >> /tmp/test.file ,:=58)
> AppendTwoDimItem(itemlist, sep= )
> Set2DLIst()
> Get2DListEnt()
> Get2DLIstEnt returns /bin/echo pass1 shell >> /tmp/test.file 
> IncrementTwoDimList()
> AddInstallable()
> AddInstallable()
> Get2DListEnt()
>    END InstallPending]
> 
> HandleClass(pass2.pass2_done)
> Compound class = (pass2.pass2_done) with 2 members
>    (No actions pending in User Shell Commands:)
> InitializeAction()
> path = (/bin/echo pass2 shell SUCCESS  >> /tmp/test.file )
> 
>    [BEGIN InstallPending User Shell Commands:
> Installing item (/bin/echo pass2 shell SUCCESS  >> /tmp/test.file ) in the
> script list
> Build2DListFromVarstring(/bin/echo pass2 shell SUCCESS  >> /tmp/test.file
> ,sep= )
> SplitVarstring(/bin/echo pass2 shell SUCCESS  >> /tmp/test.file ,:=58)
> AppendTwoDimItem(itemlist, sep= )
> Set2DLIst()
> Get2DListEnt()
> Get2DLIstEnt returns /bin/echo pass2 shell SUCCESS  >> /tmp/test.file 
> IncrementTwoDimList()
> AddInstallable()
> AddInstallable()
> Get2DListEnt()
>    END InstallPending]
> 
> (END OF PARSING)
> Accepted domain name: eur.sas.com
> 
> 
> Defined Classes = ( any redhat redhat_7 redhat_7_0 opt_debug Friday Hr15
> Min51 Min50_55 Day9 March Yr2001 linux destroy_eur_sas_com eur_sas_com
> destroy 32_bit linux_2_2_16_22 i686 linux_i686 linux_i686_2_2_16_22
> linux_i686_2_2_16_22__1_Tue_Aug_22_16_49_06_EDT_2000 linux_gnu 130_96_14
> 130_96_14_218 )
> 
> Negated Classes = ( )
> 
> Installable classes = ( pass2 pass1 pass1_done pass2_done )
> 
> Global expiry time for locks: 120 minutes
> 
> Global anti-spam elapse time: 0 minutes
> 
> Extensions which should not be directories = ( )
> Suspicious filenames to be warned about = ( )
> Directory for /var/run/cfengine/test exists. Okay
> Directory for /var/run/cfengine/test exists. Okay
> Reference time set to Fri Mar  9 15:51:40 2001
> 
> (BuildClassEnvironment)
> 
>                   New temporary class additions
>                   -----------------------------
>                              pass1
> ---------------------------------------------------------------------
> Editing files
> ---------------------------------------------------------------------
> 
> WrapDoEditFile(/tmp/test.file,/tmp/test.file)
> FileObjectFilter(/tmp/test.file)
> DoEditFile(/tmp/test.file)
> IgnoredOrExcluded(/tmp/test.file)
> GetLock(editfile.pass1,_tmp_test_file,time=984149500), ExpireAfter=120,
> IfElapsed=0
> GetLastLock()
> CheckOldLock()
> SetLock(/var/run/cfengine/lock.cf_test.destroy.editfile.pass1._tmp_test_file
> )
> cfengine:destroy: Begin editing /tmp/test.file
> Emptying entire file
> Edit: Inserting file /etc/motd 
> Appending [# pass1 on the editfiles]
> cfengine:destroy: End editing /tmp/test.file
> .....................................................................
> CompareToFile(/tmp/test.file)
> cfengine:destroy: Edited file /tmp/test.file 
> Entering AddEditfileClasses(pass1_done)
> AddClassToHeap(pass1_done)
> ReleaseCurrentLock(/var/run/cfengine/lock.cf_test.destroy.editfile.pass1._tm
> p_test_file)
> LockLog(Lock removed normally)
> (BuildClassEnvironment)
> 
>                   New temporary class additions
>                   -----------------------------
>                              pass1
> ---------------------------------------------------------------------
> Running shell commands
> ---------------------------------------------------------------------
> 
> GetLock(shellcommand.pass1,_bin_echo_pass1_shell_____tmp_test_file_,time=984
> 149500), ExpireAfter=120, IfElapsed=0
> GetLastLock()
> CheckOldLock()
> SetLock(/var/run/cfengine/lock.cf_test.destroy.shellcommand.pass1._bin_echo_
> pass1_shell_____tmp_test_file_)
> cfengine:destroy: Executing script /bin/echo pass1 shell >> /tmp/test.file
> ...(timeout=0,uid=-1,gid=-1)
> (Setting umask to 77)
> cfpopen(/bin/echo pass1 shell >> /tmp/test.file )
> cfpclose(pp)
> cfpopen - Waiting for process 30886
> cfengine:destroy: Finished script /bin/echo pass1 shell >> /tmp/test.file 
> ReleaseCurrentLock(/var/run/cfengine/lock.cf_test.destroy.shellcommand.pass1
> ._bin_echo_pass1_shell_____tmp_test_file_)
> LockLog(Lock removed normally)
> (BuildClassEnvironment)
> 
>                   New temporary class additions
>                   -----------------------------
>                              pass2
> ---------------------------------------------------------------------
> Editing files
> ---------------------------------------------------------------------
> 
> WrapDoEditFile(/tmp/test.file,/tmp/test.file)
> FileObjectFilter(/tmp/test.file)
> DoEditFile(/tmp/test.file)
> IgnoredOrExcluded(/tmp/test.file)
> GetLock(editfile.pass2,_tmp_test_file,time=984149500), ExpireAfter=120,
> IfElapsed=0
> GetLastLock()
> CheckOldLock()
> SetLock(/var/run/cfengine/lock.cf_test.destroy.editfile.pass2._tmp_test_file
> )
> cfengine:destroy: Begin editing /tmp/test.file
> Appending [# pass2 on the editfiles]
> cfengine:destroy: End editing /tmp/test.file
> .....................................................................
> CompareToFile(/tmp/test.file)
> cfengine:destroy: Edited file /tmp/test.file 
> cfengine:destroy: The file /tmp/test.file.cfsaved has already been moved to
> the repository once.
> cfengine:destroy: Multiple update will cause loss of backup. Use
> backup=false in copy to override.
> Entering AddEditfileClasses(pass1_done)
> AddClassToHeap(pass1_done)
> ReleaseCurrentLock(/var/run/cfengine/lock.cf_test.destroy.editfile.pass2._tm
> p_test_file)
> LockLog(Lock removed normally)
> (BuildClassEnvironment)
> 
>                   New temporary class additions
>                   -----------------------------
>                              pass2
> ---------------------------------------------------------------------
> Running shell commands
> ---------------------------------------------------------------------
> 
> 
> _______________________________________________
> Bug-cfengine mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-cfengine

-- 


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