Forum: CFEngine Help
Subject: Bug in readstringarray with big field ?
Author: jbdenis
Link to topic: https://cfengine.com/forum/read.php?3,25946,25946#msg-25946
Hello everybody,
I found a weird behaviour using "readstringarray". I'm trying to read a file
formatted this way :
grouptest:x:42:1,2,3,4,5,6,7.......,1000
Here is the policy I'm using :
body common control
{
bundlesequence => { "example" };
}
###########################################################
bundle agent example
{
vars:
"dim_array"
int =>
readstringarray("array_name","/tmp/group.test","#[^\n]*",":",10000000,10000000);
"idx" slist => getindices("array_name");
reports:
cfengine_3::
"$(array_name[$(idx)])";
}
And the output :
$ /usr/local/sbin/cf-agent -KI -f ./test_readstringarray.cf
R: $(array_name)
R:
$(array_name[80,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311])
R:
$(array_name[36,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567])
R:
$(array_name[92,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823])
I think that I should only have one line of report, "$(array_name)". If you
confirm this is a weird behaviour, I'll open a bug.
You can also find the files here : https://gist.github.com/2709217
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine