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

Unable to select last region of file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.9.0
    • Component/s: Promise type: files
    • Labels:
      None

      Description

      With select INI_section I am unable to select the last section of a file.

      I believe this is caused by select_end not matching for end of file in body select_region INI_section. I can't think of a regex to match end of file. I think select_end should match the pattern or end of file. Or maybe there needs to be a separate option on like select_end_includes_EOF true/false.

      The example policy illustrates how manage_variable_values_ini will create the section but is unable to select that section for inserting the promised key value pairs.
      <pre>
      % cf-agent -KIf ./test_manage_variable_values_ini.cf
      !! The promised line deletion (.*) could not select an edit region in /tmp/testfile.txt (but the delimiters were expected in the file)
      !! The promised line deletion (.*) could not select an edit region in /tmp/testfile.txt (but the delimiters were expected in the file)
      !! The promised line deletion (.*) could not select an edit region in /tmp/testfile.txt (but the delimiters were expected in the file)
      R: I didnt fine variable3, its probably broken

      % cat /tmp/testfile.txt
      [section1]

      % cf-agent -KIf ./test_manage_variable_values_ini.cf
      !! The promised line deletion (.*) could not select an edit region in /tmp/testfile.txt (but the delimiters were expected in the file)
      !! The promised line deletion (.*) could not select an edit region in /tmp/testfile.txt (but the delimiters were expected in the file)
      !! The promised line deletion (.*) could not select an edit region in /tmp/testfile.txt (but the delimiters were expected in the file)
      R: I didnt fine variable3, its probably broken

      % cat /tmp/testfile.txt
      [section1]
      </pre>

      The workaround I have used is very brittle. A separate append to bottom insert lines for another section header. But you have to be careful to only insert new sections above that known header. Then there is the issue of how an application might interpret the fake section.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10003 Eystein Maloy Stenberg
                Reporter:
                jiraadmin Old User (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel