Forum: Cfengine Help
Subject: Re: segfault using edit_line with 3.1.0b2
Author: babudro
Link to topic: https://cfengine.com/forum/read.php?3,18764,18777#msg-18777

Today's observations:  If I comment-out the second promise, the one regarding 
/etc/default/useradd, the segfault goes away on the 64-bit boxes, but not the 
32-bit one.

On the 32-bit box I whittled the rules down to this skeletal set:

promises.cf


body common control {
  bundlesequence => { "definitions", "auth_defaults" };
  inputs         => { "auth.cf" };
  }

body server control  {
  allowconnects     => { @(cfengine_hosts) };
  allowallconnects  => { @(cfengine_hosts) };
  cfruncommand      => "$(sys.workdir)/bin/cf-agent";
  allowusers        => { "root" };
  }

bundle common definitions {
  vars:
    "cfengine_hosts"  slist => { "127.0.0.1", ":::1", "10.0.0.0/8" };
  }

bundle server access_rules() {
  access:
    "/var/cfengine/masterfiles"
    admit  => { @(cfengine_hosts) };

    "/var/cfengine/bin/cf-agent"
    admit  => { @(cfengine_hosts) };
  }

body edit_field col(split,col,newval,method) {
  field_separator    => "$(split)";
  select_field       => "$(col)";
  value_separator    => ",";
  field_value        => "$(newval)";
  field_operation    => "$(method)";
  extend_fields      => "true";
  allow_blank_fields => "true";
  }


auth.cf

bundle agent auth_defaults {
  files:
    "/etc/login.defs"
    comment       => "Maintain password policy settings",
    create        => "false",
    edit_defaults => etc_files,
    edit_line     => login_defaults("90");
  }

bundle edit_line login_defaults(maxday) {
  field_edits:
    "^(PASS_MAX_DAYS\t)([0-9]+)$"
      edit_field    => col("\t","2","$(maxday)","set"),
      comment       => "Reset PASS_MAX_DAYS log-in value according to policy, 
if necessary.";
  }

body edit_defaults etc_files {
  empty_file_before_editing => "false";         #|We will just verify & 
re-write single lines
  edit_backup               => "true";          #|Keep a back-up if it changes
  max_file_size             => "64k";           #|Most config files are under 
64k
  }


I put these two into a fresh directory with nothing but these two files, run 
*cf-promises -f ./promises.cf* and see no errors; run *cf-agent -IKf 
./promises.cf" and it bombs as always.

If I run my promise that edits /etc/resolv.conf it works fine, so it's not all 
edit_line operations nor all files in /etc/ that are the problem.

Is anyone else able to reproduce this or provide any other diagnostic ideas?

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to