Hi, I have noticed having recently updated my SVN directory that the replace function from textops now fails with E_BUG in the fixup function (i.e. fails when parsing the config).
This appears to be the result of this change to textops.c: ------------------------------------------------------------------------ r2119 | henningw | 2007-05-02 15:32:20 +0100 (Wed, 02 May 2007) | 3 lines * move fixup_str2regexp function to mod_fix.h * remove the implementations in tm and textops ------------------------------------------------------------------------ Previously, the code would just do 'return 0' in the param_no != 1 case, now it returns E_BUG which appears to make openser crash. I have attached a patch which restores the previous behaviour while still using the generic fixup_str2regexp function, however I am curious if I am doing something wrong? It seems odd this problem could have been unnoticed for 3 months. My config file just does a fairly simple replace("string1", "string2"). If I'm doing something wrong please let me know, otherwise, the attached patch should hopefully be ok. Please note I have only tested the change with the 'replace' function however the other similar functions should work the same way, I think. cheers -ben -- Ben Smithurst http://www.bensmithurst.com/
Index: textops.c =================================================================== --- textops.c (revision 2607) +++ textops.c (working copy) @@ -117,6 +117,7 @@ static int it_list_fixup(void** param, int param_no); static int fixup_body_type(void** param, int param_no); static int fixup_privacy(void** param, int param_no); +static int fixup_replace(void** param, int param_no); static int mod_init(void); @@ -126,17 +127,17 @@ REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, {"search_body", search_body_f, 1, fixup_str2regexp, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, - {"search_append", search_append_f, 2, fixup_str2regexp, + {"search_append", search_append_f, 2, fixup_replace, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, - {"search_append_body", search_append_body_f, 2, fixup_str2regexp, + {"search_append_body", search_append_body_f, 2, fixup_replace, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, - {"replace", replace_f, 2, fixup_str2regexp, + {"replace", replace_f, 2, fixup_replace, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, - {"replace_body", replace_body_f, 2, fixup_str2regexp, + {"replace_body", replace_body_f, 2, fixup_replace, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, - {"replace_all", replace_all_f, 2, fixup_str2regexp, + {"replace_all", replace_all_f, 2, fixup_replace, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, - {"replace_body_all", replace_body_all_f,2, fixup_str2regexp, + {"replace_body_all", replace_body_all_f,2, fixup_replace, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, {"append_to_reply", append_to_reply_f, 1, it_list_fixup, REQUEST_ROUTE|BRANCH_ROUTE|ERROR_ROUTE}, @@ -763,6 +764,15 @@ } +static int fixup_replace(void** param, int param_no) +{ + if (param_no == 1) + return fixup_str2regexp(param, param_no); + else + return 0; +} + + static int fixup_substre(void** param, int param_no) { struct subst_expr* se;
_______________________________________________ Devel mailing list Devel@openser.org http://openser.org/cgi-bin/mailman/listinfo/devel