Project

General

Profile

Actions

Bug #24537

closed

Regex in file replace line must not match the string used as replacement

Added by Elaad FURREEDAN 8 months ago. Updated 7 months ago.

Status:
Released
Priority:
N/A
Category:
Generic methods
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:
No

Description

If the regex match the string used as replacement, the method will fail to replace the line

2024-03-18T23:58:06+00:00    error: Promised replacement 'DNS1=1.1.1.1' on line 'DNS1=123.4.23.4' for pattern 'DNS1(.*)' is not convergent while editing '/tmp/ifcfg-eth0' (regular expression matches the replacement string)
2024-03-18T23:58:06+00:00    error: Promise belongs to bundle 'regex_replace' in file '/var/rudder/ncf/common/20_cfe_basics/cfengine/files.cf' near line 328
2024-03-18T23:58:06+00:00    error: Comment is 'Search and replace string'
2024-03-18T23:58:06+00:00    error: Errors encountered when actuating replace_patterns promise 'DNS1(.*)'

The documentation of the method does not mention this behavior, and it is not clear why the method is not working.

Actions

Also available in: Atom PDF