cf3 (3.0.2) readstring array with no values (after comments)

View: New views
2 Messages — Rating Filter:   Alert me  

cf3 (3.0.2) readstring array with no values (after comments)

by Matt Richards-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings. A little issue with using readstringlist. It seems the list
gets populated with garbage characters when the resulting list should
contain nothing. I tried to track it down, but I think Mark would find
this one within minutes.

Consider the following example:

##########################################################################

body common control {

    bundlesequence => { "readstring_test" };

}

##########################################################################


bundle agent readstring_test {

  vars:

    "entry" slist => { readstringlist("/tmp/testfile","#.*","[\n]",200,4000) };

  reports:
    Yr2009::
       "entry:$(entry)";
}

##########################################################################


If /tmp/testfile contain only comments:

############################################
# comments
#
# more comments
#
# boy, do I love comments
#
############################################

The resulting report looks like:

cf3    =========================================================
cf3    reports in bundle readstring_test (1)
cf3    =========================================================
cf3
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3
cf3     .........................................................
cf3     Promise handle:
cf3     Promise made by: entry:  ¸ <<<< ouch (part 1)
cf3     .........................................................
cf3
cf3 R: entry:  ¸ <<<<<< ouch (part 2)
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@...
https://cfengine.org/mailman/listinfo/bug-cfengine

Re: cf3 (3.0.2) readstring array with no values (after comments)

by Mark Burgess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Fixed svn 495

Matt Richards wrote:

> Greetings. A little issue with using readstringlist. It seems the list
> gets populated with garbage characters when the resulting list should
> contain nothing. I tried to track it down, but I think Mark would find
> this one within minutes.
>
> Consider the following example:
>
> ##########################################################################
>
> body common control {
>
>     bundlesequence => { "readstring_test" };
>
> }
>
> ##########################################################################
>
>
> bundle agent readstring_test {
>
>   vars:
>
>     "entry" slist => { readstringlist("/tmp/testfile","#.*","[\n]",200,4000) };
>
>   reports:
>     Yr2009::
>        "entry:$(entry)";
> }
>
> ##########################################################################
>
>
> If /tmp/testfile contain only comments:
>
> ############################################
> # comments
> #
> # more comments
> #
> # boy, do I love comments
> #
> ############################################
>
> The resulting report looks like:
>
> cf3    =========================================================
> cf3    reports in bundle readstring_test (1)
> cf3    =========================================================
> cf3
> cf3 Verifying SQL table promises is only available with Cfengine Nova or above
> cf3
> cf3     .........................................................
> cf3     Promise handle:
> cf3     Promise made by: entry:  ¸ <<<< ouch (part 1)
> cf3     .........................................................
> cf3
> cf3 R: entry:  ¸ <<<<<< ouch (part 2)
> _______________________________________________
> Bug-cfengine mailing list
> Bug-cfengine@...
> https://cfengine.org/mailman/listinfo/bug-cfengine

--
Mark Burgess

-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway

Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@...
https://cfengine.org/mailman/listinfo/bug-cfengine