I may be mixing up two different versions, if cf-agent forks and execs 
cf-agent/cf-promises from the working directory binaries. 

Is it possible to test cf-* binaries from within the build directory before 
installation?

I've now copied the cf-* binaries into the working directory 
(/var/cfengine/bin) - and now it does look like it's parsing correctly - but on 
RHEL 5, segfaulting in SelectOwnerMatch with this slightly modified test case:

body common control {
        bundlesequence => { "s" };
}
bundle agent s {
 files:
        "/tmp"
                depth_search => roottraverse,
                file_select => noowner,
                perms => pnoowner,
                action => warn;
}
body depth_search roottraverse{
        depth => "inf";
        include_basedir => "true";
}

body file_select noowner {
        search_owners => { "[a-zA-Z0-9_.]+" };
        file_result => "!owner";
}

body action warn{
        action_policy => "warn";
}

body perms pnoowner {
        owners => { "root" };
        groups => { "root" };
}


Last hopefully relevant lines of cf-agent -d2 (I'll backchannel if you want the 
whole output):
--------
EvaluateORString(!owner)
(!)(o)(w)(n)(e)(r)
GetORATom(!owner)->!owner
EvaluateANDString(!owner)

GetANDATom(owner)->owner
Checking OR atom (owner)?
EvaluateANDString(!owner) returns false by negation 2
EvalORString-temp-result-n=0 (!owner)
EvaluateORString(!owner) returns 0
Select result "!owner"on /tmp/nerves was 0
Unappending leaf_name
Unappending leaf_path
Unappending owner
Unappending group
Skipping non-selected file /tmp/nerves
Unappending reg
Unappending plain

--------
EvaluateORString([a-zA-Z0-9_.]+)
([)(a)(-)(z)(A)(-)(Z)(0)(-)(9)(_)(.)(])(+)
GetORATom([a-zA-Z0-9_.]+)->[a-zA-Z0-9_.]+
EvaluateANDString([a-zA-Z0-9_.]+)

GetANDATom([a-zA-Z0-9_.]+)->[a-zA-Z0-9_
Checking OR atom ([a-zA-Z0-9_)?
EvaluateANDString([a-zA-Z0-9_.]+) returns false ny negation 3
EvalORString-temp-result-n=0 ([a-zA-Z0-9_.]+)
EvaluateORString([a-zA-Z0-9_.]+) returns 0
Segmentation fault

--
Chris Faehl
Hosting Engineering Systems Manager, RightNow Technologies


-----Original Message-----
From: Mark Burgess [mailto:mark.burg...@iu.hio.no] 
Sent: Thursday, May 07, 2009 1:33 PM
To: Faehl, Chris
Cc: bug-cfengine@cfengine.org
Subject: Re: cf3: incorrect parsing or misdocumented file_select.search_owners 
attribute


Chris, I don't think this is possible. Are you mixing up two versions?

M

Faehl, Chris wrote:
> Mark,
> 
> From svn, cf-promises now validates the input file correctly - but cf-agent 
> evaluates using the pre-change semantics (fails just as cf-promises did). 
> 
> --
> Chris Faehl
> Hosting Engineering Systems Manager, RightNow Technologies
> 
> 
> -----Original Message-----
> From: Mark Burgess [mailto:mark.burg...@iu.hio.no] 
> Sent: Wednesday, May 06, 2009 11:22 AM
> To: Faehl, Chris
> Cc: bug-cfengine@cfengine.org
> Subject: Re: cf3: incorrect parsing or misdocumented 
> file_select.search_owners attribute
> 
> 
> Ok - I've thought about this now. Please try svn and tell me if it
> works as expected.
> 
> M
> 
> Faehl, Chris wrote:
>> Using cfengine 3.0.1 and cfengine 3 svn 328:
>> Objective: find unowned files and assign them a default owner.
>> Problem: search_owners doesn't seem to really accept regexes, as documented 
>> examples suggest. Search_groups suffers this same malady. It's difficult to 
>> see how the required objective could be met without at least working 
>> character classes and the "+" operator.
>>
>> Test case:
>> body common control {
>>         bundlesequence => { "s" };
>> }
>> bundle agent s {
>>  files:
>>         "/"
>>                 file_select => noowner,
>>                 perms => pnoowner,
>>                 action => warn;
>> }
>>
>> body file_select noowner {
>>         search_owners => { "[a-zA-Z0-9_.]+" };
>>         file_result => "!owner";
>> }
>>
>> body action warn{
>>         action_policy => "warn";
>> }
>>
>> body perms pnoowner {
>>         owners => { "root" };
>>         groups => { "root" };
>> }
>>
>>
>> Cf-promises -v -f ./test7.cf:
>> .
>> .
>> .
>> cf3   > Parsing file ./test7.cf
>> cf3:./test7.cf:13,38: Scalar item in search_owners => { [a-zA-Z0-9_.]+ } in 
>> rvalue is out of bounds (value should match pattern [a-zA-Z0-9_$.-]+), near 
>> token '}'
>> .
>> .
>> .
>>
>>
>> Cf-promises -d2 -f ./test7.cf:
>> .
>> .
>> .
>> ------------------------------------------------
>>  - Checking inline constraint/arg file_select[(ext body)] => mappedval 
>> (bundle/body)
>>  ------------------------------------------------
>> Nothing to check for body reference
>> end CheckConstraintTypeMatch---------
>>   Post Check Constraint files: search_owners => {'[a-zA-Z0-9_.]+'}
>>  ------------------------------------------------
>>  - Checking inline constraint/arg search_owners[slist] => mappedval (l) 
>> [a-zA-Z0-9_$.-]+
>>  ------------------------------------------------
>>  ------------------------------------------------
>>  - Checking inline constraint/arg search_owners[slist] => mappedval (s) 
>> [a-zA-Z0-9_$.-]+
>>  ------------------------------------------------
>>
>> CheckParseString(search_owners => [a-zA-Z0-9_.]+/[a-zA-Z0-9_$.-]+)
>> Deleting scope match
>> Object match exists
>> Adding scope data match
>> Regex [a-zA-Z0-9_$.-]+ did not match ([a-zA-Z0-9_.]+) exactly, but it 
>> matched a part of it.
>> IsCf3VarString([a-zA-Z0-9_.]+) - syntax verify
>> Found 0 variables in ([a-zA-Z0-9_.]+)
>> Validation: Scalar item in search_owners => { [a-zA-Z0-9_.]+ } in rvalue is 
>> out of bounds (value should match pattern [a-zA-Z0-9_$.-]+)
>> end CheckConstraintTypeMatch---------
>>   Post Check Constraint files: file_result =>!owner
>> .
>> .
>> .
>> --
>> Chris Faehl
>> Hosting Engineering Systems Manager, RightNow Technologies
>>
>> _______________________________________________
>> Bug-cfengine mailing list
>> Bug-cfengine@cfengine.org
>> 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@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to