Probably you need to upgrade to 3.0.2b - this has to do with buggy regex libraries and my failure to make a good workaround.
M Dean White wrote: > I keep getting seg faults with my replace_patterns portion of edit_line. > Here’s a code snippet that correctly works: > > > > bundle edit_line shadow > > > > { > > > > delete_lines: > > > > "root.*"; > > > > insert_lines: > > > > "root:$1$TypicalHashEncoding:13949:0:99999:7:::" location => start; > > > > } > > > > Now, if I add this to that edit_line bundle: > > > > replace_patterns: > > > > "user.*" replace_with => > With("user:$1$AnotherHashEnconding:13935:0:99999:7:::"); > > > > It will seg fault. I thought maybe it was from non-alphanumeric > characters, so I put this in: > > > > "user.*" replace_with => With("user"); > > > > And it still seg faults. The With body is straight from the > documentation/examples as follows: > > > > body replace_with With(x) > > > > { > > replace_value => "$(x)"; > > occurrences => "all"; > > } > > > > The edit_line gets called as follows: > > > > bundle agent main > > > > { > > > > … other non-related code … > > > > files: > > > > “/etc/shadow” > > > > create => “true”, > > edit_line => shadow, > > edit_defaults => def; > > > > } > > > > The edit_defaults is thus: > > > > body edit_defaults def > > { > > empty_file_before_editing => "false"; > > edit_backup => "false"; > > max_file_size => "100000"; > > } > > > > Output from gdb: > > > > #0 0x00723f03 in regexec@@GLIBC_2.3.4 () from /lib/libc.so.6 > > #1 0x0808d85a in RegExMatchSubString () > > #2 0x08069d52 in ReplacePatterns () > > #3 0x0806abb0 in VerifyPatterns () > > #4 0x0808bb0a in ExpandPromiseAndDo () > > #5 0x0808c1e3 in ExpandPromise () > > #6 0x0806b318 in ScheduleEditLineOperations () > > #7 0x08066bdf in ScheduleEditOperation () > > #8 0x08061654 in VerifyFilePromise () > > #9 0x0804c88c in LocateFilePromiserGroup () > > #10 0x0804ce67 in FindFilePromiserObjects () > > #11 0x0804ce8a in FindAndVerifyFilesPromises () > > #12 0x0804b480 in KeepAgentPromise () > > #13 0x0808bb0a in ExpandPromiseAndDo () > > #14 0x0808c1e3 in ExpandPromise () > > #15 0x0804b716 in ScheduleAgentOperations () > > #16 0x0804b8c6 in KeepPromiseBundles () > > #17 0x0804c3b5 in KeepPromises () > > #18 0x0804c7d4 in main () > > > > Any suggestions? > > > ------------------------------------------------------------------------ > > _______________________________________________ > 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