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

@{} results in seg fault

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.3
    • Component/s: Evaluation
    • Labels:
      None

      Description

      The following results in a seg fault. I think if the agent encounters @{} in scalar context it should treat it like a string and not attempt any expansion.
      <pre>
      body common control
      {
      bundlesequence =>

      { "main", }

      ;
      }

      bundle agent main
      {
      vars:
      "policy_servers" slist =>

      { "10.0.0.1", "10.0.0.2" }

      ;

      methods:
      "any" usebundle => init;
      "any" usebundle => test( "${sys.workdir}/inputs/init.txt" );
      }

      bundle agent init
      {
      commands:
      "/bin/echo 'param one ;; param two ;; @

      {main.policy_servers}' > ${sys.workdir}/inputs/init.txt"
      contain => inshell;
      "/bin/cat ${sys.workdir}/inputs/init.txt";
      }

      body contain inshell
      {
      useshell => 'yes';
      }
      bundle agent test( ref )
      {
      vars:

      "dim_test"
      comment => "Read data file for parsing.",
      handle => "efl_packageg_vars_files",
      int => readstringarrayidx(
      "test_o",
      "${ref}",
      "\s*#[^\n]*",
      "\s*;;\s*",
      "500",
      "1M"
      );

      "p"
      comment => "Get index array loaded above.",
      handle => "efl_packageg_vars_p",
      slist => getindices( "test_o" );

      "p2"
      comment => "Work around for bug 2333",
      slist => { "0", "1", "2" };

      "test[${p}][${p2}]"
      comment => "Work around for bug 2333",
      comment => "Work around for bug 2333",
      string => "${test_o[${p}][${p2}]}";

      reports:
      "${test[${p}][0]}, ${test[${p}][1]}, ${test[${p}][2]}";

      }
      </pre>

      Acutal results:
      <pre>
      neil@ettin:~/.cfagent/inputs$ cf-agent -KIf ./list.cf
      2013-10-01T12:08:31-0400 info: Executing 'no timeout' ...
      '/bin/echo 'param one ;; param two ;; @{main.policy_servers}

      ' >
      /home/neil/.cfagent/inputs/init.txt'
      2013-10-01T12:08:31-0400 info: Completed execution of '/bin/echo
      'param one ;; param two ;; @

      {main.policy_servers}' >
      /home/neil/.cfagent/inputs/init.txt'
      2013-10-01T12:08:31-0400 info: Executing 'no timeout' ...
      '/bin/cat /home/neil/.cfagent/inputs/init.txt'
      2013-10-01T12:08:31-0400 notice: Q: ".../bin/cat /home/": param
      one ;; param two ;; @{main.policy_servers}

      2013-10-01T12:08:31-0400 info: Last 1 quoted lines were
      generated by promiser '/bin/cat /home/neil/.cfagent/inputs/init.txt'
      2013-10-01T12:08:31-0400 info: Completed execution of '/bin/cat
      /home/neil/.cfagent/inputs/init.txt'
      2013-10-01T12:08:31-0400 notice: R: param one, param two, 10.0.0.1
      Segmentation fault
      </pre>

      Expected results
      <pre>R: param one, param two, @

      {main.policy_servers}

      </pre>

      Thoughts on a work around welcome.

        Attachments

          Activity

            People

            • Assignee:
              a10025 Volker Hilsheimer (Inactive)
              Reporter:
              neilhwatson Neil Watson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel