Project

General

Profile

Enhancement #5983

Updated by BenoƮt PECCATTE over 9 years ago

cf-agent gives an error with the following code :  

 <pre> 
 bundle edit_line edit_one_line 
 { 
         replace_patterns: 
                 "^test.*" replace_with => value("test me"); 
 } 
 </pre> 

 Withs this kind of error  
 <pre> 
 2014-12-11T14:56:50+0100      error: /default/test4/files/'/tmp/test'/default/edit_one_line/replace_patterns/'^test.:'[0]: Promised replacement 'test' on line 'test ij' for pattern '^test.*' is not convergent while editing '/tmp/test' 
 2014-12-11T14:56:50+0100      error: /default/test4/files/'/tmp/test'/default/edit_one_line/replace_patterns/'^test.:'[0]: Because the regular expression '^test.*' still matches the replacement string 'test me' 
 </pre> 

 It says that its not convergent since you replace a line with itself. 
 Nobody can understand that, and the user is understandably confused. 

 cfengine should be modified to make a regex that do not modify a line BE convergent. 

 For people wanting to work around this, you must prepend a zero width negative forward lookahead in your regex everywhere you have a quantifier that could match the final thing. 
 In this test case it would look like "^test(?! me).*" 

Back