Skip to main content.
home | support | download

Back to List Archive

Re: Fwd: Error Condition Re: ReplaceRules remove

From: <jmruiz(at)>
Date: Wed Aug 23 2000 - 08:52:11 GMT
Hi Doug,

Finally, a bug...

I applied these patches to checkReplaceList

It was my fault, I did not check these patches. Both seems not to
be compatible together. In fact, the second one puts a call to 
regfree at the end of the function, even if you do not make a call to 

Now checkReplaceList looks like:

/* Checks that all the regex in the replace list are correct */
void checkReplaceList()
        struct swline *tmpReplace;
        static int lenrule=0;
        static char *rule=NULL;
        static int lenpatt=0;
        static char *patt=NULL;
        regex_t re;
        int status;

        if(!lenrule) rule = (char *) emalloc((lenrule=MAXSTRLEN) + 1);
        if(!lenpatt) patt = (char *) emalloc((lenpatt=MAXSTRLEN) + 1);
        tmpReplace = replacelist;
        while (tmpReplace) {
                rule = SafeStrCopy(rule,tmpReplace->line,&lenrule);

                /*  If it is not replace, just do nothing */
                if (lstrstr(rule,"append") || lstrstr(rule,"prepend") ) {
                        if (tmpReplace->next){
                                tmpReplace = tmpReplace->next;
                if (lstrstr(rule,"replace")) {
                        tmpReplace = tmpReplace->next;
                        patt = SafeStrCopy(patt,tmpReplace->line,&lenpatt);
                        if (patt == NULL)
                        status = regcomp(&re,patt, REG_EXTENDED);
                        regfree(&re); /** Marc Perrin ## 18Jan99 **/
                        if (status != 0) {
                                printf ("Illegal regular expression %s\n", patt)

                        if (tmpReplace->next)
                                tmpReplace = tmpReplace->next;
                        else {
                                regfree(&re);       <--------------REMOVE!!!
                tmpReplace = tmpReplace->next;
        regfree(&re);        <--------REMOVE!!

I think that if you remove the two lines pointed by REMOVE, it may 
Let me know if this solves your problem.

Sorry for the inconvenience.


On 22 Aug 2000, at 11:52, Doug Garret wrote:

> Hi--
> I get a seg fault when using the "ReplaceRules remove" configuration option. 
>   (It seems to fail in checkReplaceList (in regfree)).   I was able to use 
> this option in swish-e 1.3.2, and other than this modification, I can use 
> the same config file.  I can't find any documentation on new/different usage 
> of this feature in swish-e 2.  Any ideas?
> Thank You,
> Doug
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
Received on Wed Aug 23 08:56:13 2000