It seems that splitstring("", " ", 100) returns a slist with an empty
string:

body common control
{
      bundlesequence => { "test" };
}

bundle agent test
{
  vars:
      "spaces" slist => splitstring("", " ", "100");

  reports:
    cfengine::
      "spaces '$(spaces)'";
}

=>

R: spaces ''

To me, this was unexpected, and I think it should be documented.  But
the reason I'm not opening a bug immediately is I don't know what's the
right way to fix it, since cfengine doesn't allow empty slists AFAIK.  I
know no other language behaves this way, and it can cause some nasty
surprises.

Right now I'm skipping the use of $(spaces) if the original string is
empty, using strcmp(), but that seems like a pretty nasty hack.

Thanks
Ted
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to