i can reproduce the bug while trying to edit the debian default
collectd.conf file. i'm trying to say, that generally negative values of
IncrementPointer are ignored (i dont know, if only inside of groups).
- want to edit this block ("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:
[ ... ]
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
regards,
martin
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]