Hi all

There appears to be a bug with NameRegex filters in editfiles:
If a filter matches any file in the directory, all files in the directory 
are edited.

The version is 2.1.20 using the package from blastwave
Also noted by Edward F. Brown that this is also the case in 2.1.22

Nexus and client is on sun 5.9 sparc

Test scenario...

In a directory /dir1/dir2/conf
I have a whole bunch of files:

a_exporter.conf
b_exporter.conf
c_importer.conf
d_importer.conf
afilenoext

We only edit files that match the regular expression *importer.conf
eg. change string yyy with string xxx
All files in the directory may the string yyy.

If I use a filter like so below, all the files in the /dir1/dir2/conf path 
get
edited.

<snip>
  control:
   actionsequence   = ( directories files editfiles  )
   editfilesize     = ( 200000 )

  filters:
  { filteralias
    NameRegex: "^.*importer\.conf$"
    Result:   "NameRegex"
  }

  ignore:
      any::
        *.cfsaved

  editfiles:
     10_240_64_230::
       { /dir1/dir2/conf
           Filter "filteralias"
           BeginGroupIfNoSuchLine "yyy"
              ReplaceFirst "yyy" With "zzz"
              DefineInGroup "edit_blah_blah"
           EndGroup
       }
 
  alerts:
      edit_blah_blah::
        "File has been edited"
 
</snip>

Should we use sourceforge.net 
http://sourceforge.net/tracker/?func=browse&group_id=126712&atid=706640
or gnu.org to submit bugs ?
http://savannah.gnu.org/bugs/?func=additem&group=cfengine

Many thanks.
Shun 




_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to