-
Type:
Bug
-
Status: Done
-
Priority:
Medium
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Built-in functions
-
Labels:None
Regarding https://groups.google.com/forum/#!topic/help-cfengine/6G1FNPih1Lo
It seem that there is a confusing bug with lsdir. Here is a example : let's say we have this directory tree :
test └── FR0000001-12345678.gz prod └── FR0000001-12345678.gz
here is the code :
body common control { bundlesequence => { "readdirs" }; } bundle agent readdirs { vars: "directories" slist => {"prod","test"}; "files_regex_1_$(directories)" slist => lsdir("$(directories)",".*","false"); "files_regex_2_$(directories)" slist => lsdir("$(directories)","FR.*\.gz","false"); reports: any:: "regex_1 : $(directories) - $(files_regex_1_$(directories))"; "regex_2 : $(directories) - $(files_regex_2_$(directories))"; }
Normal output look like this :
notice: R: regex_1 : prod - . notice: R: regex_1 : prod - .. notice: R: regex_1 : prod - FR0000001-12345678.gz notice: R: regex_1 : test - . notice: R: regex_1 : test - .. notice: R: regex_1 : test - FR0000001-12345678.gz notice: R: regex_2 : prod - FR0000001-12345678.gz notice: R: regex_2 : test - FR0000001-12345678.gz
If i empty "prod" directory, output look like this :
notice: R: regex_1 : prod - . notice: R: regex_1 : prod - .. notice: R: regex_1 : test - . notice: R: regex_1 : test - .. notice: R: regex_1 : test - FR0000001-12345678.gz
As you can see, nothing seem to match regex_2. It seem that if one entry in the slist do not match file(s), lsdir do not return anything at all.
Regards,
Pascal Bonderff
- relates to
-
CFE-846 lsdir() broken when there is no directory
-
- Done
-