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

apt_get modules may be broken if passed empty options field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: 3.7.5, 3.10.2
    • Fix Version/s: 3.12.0, 3.10.3, 3.7.7
    • Component/s: Promise type: packages
    • Labels:
      None
    • Environment:
      Ubuntu 14.04 LTS
    • Platform:
      Ubuntu
    • Steps to reproduce:
      Manual steps provided

      Description

      When using a package promise with an empty "options" field and the apt_get module, package management is broken on some distribution, including Ubuntu 14.04.

      What happens is that the generated command is:

      execve("/usr/bin/apt-get", ["/usr/bin/apt-get", "-o", "Dpkg::Options::=--force-confold", "-o", "Dpkg::Options::=--force-confdef", "-y", "--force-yes", "", "install", "zookeeperd"]
      

      And the "" after options is interpreted as the operation name by apt, which fails with:

      E: Invalid operation
      

      A possible fix is to prevent using empty options, which allows having a parametrized options field like in:

      
        vars:
          "name" string => "emacs";
          "state" string => "present";
          "version" string => "latest";
          # "options" slist => {}; does not trigger behaviour
         "options" slist => { "" };
      
        packages:
            "${name}"
                policy         => "${state}",
                package_module => apt_get,
                version        => "${version}",
                options        => { "${options}" };
      

        Attachments

          Activity

            People

            • Assignee:
              a10042 Nick Anderson
              Reporter:
              amousset Alexis Mousset
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel