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

Unable to select file by symlink target

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.5
    • Component/s: Promise type: files
    • Labels:
      None
    • Platform:
      Any
    • Steps to reproduce:
      Acceptance/unit test attached

      Description

      I get @Unable to read link '' in filter@ when trying to delete a symlink using file_select on the link target.

      3.6.3
      <pre>
      > $ cf-agent -KIf ./remove_symlink.cf -b init,test
      2014-12-11T10:42:15-0600 info: Using command line specified bundlesequence
      2014-12-11T10:42:15-0600 info: /default/init/files/'/tmp/symlink_to_tmp_target'[0]: Linked files '/tmp/symlink_to_tmp_target' -> '/tmp/target'
      2014-12-11T10:42:15-0600 error: /default/test/files/'/tmp/symlink_to_tmp_target'[0]: Unable to read link '' in filter. (readlink: No such file or directory)
      </pre>

      3.5.3
      <pre>
      [root@policyserver vagrant]# cf-agent -KIf ./remove_symlink.cf -b init,test
      2014-12-11T17:06:03+0000 info: Using command line specified bundlesequence
      2014-12-11T17:06:03+0000 info: /init/files/'$(target)/.': Created directory '/tmp/target/.'
      2014-12-11T17:06:03+0000 info: /init/files/'$(symlink)': Linked files '/tmp/symlink_to_tmp_target' -> '/tmp/target'
      2014-12-11T17:06:03+0000 info: /test/files/'$(init#symlink)': Deleted file '/tmp/symlink_to_tmp_target'
      </pre>

      Untested but possible workaround:
      1) Use filestat to get the linktarget of a symlink.
      2) Use strcmp to check that the linktarget is as expected and set a class that guards deletion of the symlink.

        Attachments

          Activity

            People

            • Assignee:
              a10003 Eystein Maloy Stenberg
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel