Bug in the IncrementPointer-function

Florian Freund <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.bugs
Message-ID <[email protected]>
Hi,

while trying to edit the default collectd.conf from the debian  
backports collectd4-package we found an error in the IncrementPointer- 
function. if the value is negative there is no increment or decrement  
of the pointer done.
probably the debian bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=379872 
  refers to this problem (we answered to it, too).


- this block should be edited ("before" and "after"-comments inserted  
for
debugging reasons):

# before 5
# before 4
# before 3
# before 2
# before 1
#<Plugin network>
# Server "ff18::efc0:4a42" "25826"
# Server "239.192.74.66" "25826"
# Listen "ff18::efc0:4a42" "25826"
# Listen "239.192.74.66" "25826"
# TimeToLive "128"
# Forward false
# CacheFlush 1800
#</Plugin>
# after 1
# after 2
# after 3
# after 4
# after 5


- this is the relevant config:

[ ... ]
UnCommentLinesMatching ".*<Plugin network>.*"
[ ... ]
LocateLineMatching ".*<Plugin network>.*"
BeginGroupIfLineMatching ".*<Plugin network>.*"
IncrementPointer "1"
BeginGroupIfNoMatch ".*Server
server.*.mydomain.net.*"
DeleteToLineMatching ".*</Plugin>.*"
UnCommentNLines "1"
IncrementPointer "-2"
InsertLine "Server server1.mydomain.net"
InsertLine "Server server2.mydomain.net"
EndGroup
EndGroup
}


- this is the debug output (look at the <--- marks):

LocateItemMatchingRexExp(#LoadPlugin nfs,.*<Plugin network>.*)
Edit: Search ended at line 144
Edit: (Found <Plugin network>)
ExpandVarstring(.*<Plugin network>.*)
Edit action: BeginGroupIfLineMatching
LocateItemMatchingRexExp(# Config file for collectd(1).,.*<Plugin
network>.*)
Edit: Search ended at line 344
Edit: (Found <Plugin network>)
(Begin Group - line matching .*<Plugin network>.*)
ExpandVarstring(1)
Edit action: IncrementPointer
IncrementEditPointer(1)
incrementing line pointer to line 345
Current line starts: # Server "ff18::efc0:4a42" "25826" ...
ExpandVarstring(.*Server server.*.mydomain.net.*)
Edit action: BeginGroupIfNoMatch
(Begin Group - no match for .*Server server.*.mydomain.net.*)
ExpandVarstring(.*</Plugin>.*)
Edit action: DeleteToLineMatching
DeleteToRegExp(list,.*</Plugin>.*)
Edit: delete line # Server "ff18::efc0:4a42" "25826"
Edit: delete line # Server "239.192.74.66" "25826"
Edit: delete line # Listen "ff18::efc0:4a42" "25826"
Edit: delete line # Listen "239.192.74.66" "25826"
Edit: delete line # TimeToLive "128"
Edit: delete line # Forward false
Edit: delete line # CacheFlush 1800
Edit: terminating line: #</Plugin> (Done)
ExpandVarstring(1)
Edit action: UnCommentNLines
UnCommentNLines(list,1)
Terminating line: #</Plugin> (Done)
Uncomment line #</Plugin>
ExpandVarstring(-2)
Edit action: IncrementPointer
IncrementEditPointer(-2)                        <---
Current line starts: # after 1 ...              <---
ExpandVarstring(Server server1.mydomain.net)
Edit action: InsertLine
Inserting Server server1.mydomain.net
ExpandVarstring(Server server2.mydomain.net)
Edit action: InsertLine
Inserting Server server2.mydomain.net
Edit action: EndGroup
(End Group)
Edit action: EndGroup
(End Group)
End editing /etc/collectd/collectd.conf


- this is the result:

# before 5
# before 4
# before 3
# before 2
# before 1
<Plugin network>
</Plugin>
# after 1
Server server1.mydomain.net
Server server2.mydomain.net
# after 2
# after 3
# after 4
# after 5


please look at this bug. without a working IncrementPointer function  
the use of editfiles is very limited.

thanx in advance
martin and florian

--

noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk -
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.