Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-1883

insert_lines with preserve_block doesn't converge if the block contains blank lines

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.6
    • Labels:
      None

      Description

      Try the following test case in info mode:

      <pre>
      #!/var/cfengine/bin/cf-agent -Kf
      #

      body common control
      {
      inputs =>

      { "/var/cfengine/inputs/lib/3.6/files.cf" }

      ;
      bundlesequence =>

      { "test"}

      ;
      }

      bundle agent test

      { files: "/tmp/testfile" edit_line => add_good(); "/tmp/testfile" edit_line => add_bad(); }

      bundle edit_line add_good() {
      insert_lines:
      "Good 1
      Good 2
      Good 3" insert_type => "preserve_block";
      }

      bundle edit_line add_bad() {
      insert_lines:
      "Bad 1
      Bad 2

      Bad 3" insert_type => "preserve_block";
      }
      </pre>

      After the initial repair it should not be repaired anymore. However in 3.6.5, the add_bad bundle gets constantly rerepaired, adding more and more blocks to the file.

      git bisect says that this commit is the culprit:

      <pre>
      commit f545558aea330ce4098049735d733da4fd1243b5
      Author: William Orr <will@worrbase.com>
      Date: Thu Dec 11 02:33:51 2014

      MatchRegion no longer relies on a 4k buffer
      (cherry picked from commit c635120c658a1bca399469dfb3447c6fbd5df669)

      cf-agent/files_editline.c | 22 +++++++++++++++-------
      1 file changed, 15 insertions, 7 deletions
      </pre>

        Attachments

          Activity

            People

            • Assignee:
              a10040 Kristian Amlie
              Reporter:
              a10040 Kristian Amlie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel