On Fri, 30 Mar 2001, Gilles Detillieux wrote:

> Date: Fri, 30 Mar 2001 12:40:07 -0600 (CST)
> From: Gilles Detillieux <[EMAIL PROTECTED]>
> To: "Joe R. Jah" <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [htdig] Segfault on url_rewrite_rules
...

> Well, it's hard to know for sure, not having access to a BSDI system
> myself, but if I recall you had ended up building htdig with this
> patch by keeping the provided regex.h (rather than using the one on
> your system), but linking with your C library's regex.o (rather than
> using the provided regex.c).  This does sound like trouble to me!

I agree; I was too eager to make that patch apply;(

> It may very well be that the glibc version of regex.h that comes with
> htdig is incompatible with your C library's regex.o, and so htdig ends
> up calling re_match() with incorrect arguments.  Maybe we were too hasty
> in changing the FAQ!

Dittos.

> I think we should take a few steps back and look at the errors you got
> when you applied Andy Armstrongs patch, but removed regex.h so it would
> use the one from your C library's header files:
> ____________________________________________________
> In file included from RegexReplaceList.h:16,
>                  from HtURLRewriter.h:9,
>                  from URL.cc:26:
> RegexReplace.h:36: field `re' has incomplete type
> RegexReplace.h:37: field `regs' has incomplete type
> gmake[1]: *** [URL.o] Error 1
> gmake[1]: Leaving directory `/tmp/htdig-3.1.5/htlib'
> gmake: *** [all] Error 1
> ____________________________________________________
> 
> The problem lines in RegexReplace.h are:
> 
>   struct re_pattern_buffer re;    // This is the compiled source regex
>   struct re_registers regs;       // Match registers
> 
> which use structures that are defined in our regex.h, but
> apparently not in yours.  These structures are passed as arguments to
> re_compile_pattern() and re_match(), so they're pretty important.  You are
> just asking for trouble if you pass your C library's re_compile_pattern()
> and re_match() functions pointers to structures whose definitions aren't
> even known to them!  What you'd need to do is make RegexReplace.h &
> RegexReplace.cc less glibc dependent, and able to work with the equivalent
> (though different) structures used by your C library.

Yes; actially before I thought of placing regex.h back in htlib/ I
contemplated defining those structures in RegexReplace.h itself, but I got
sober;) 

> Having a look at your regex.h, to know what structures your re_match()
> uses, would be very helpful.

___________________  /usr/include/regex.h ________________________
/*      BSDI regex.h,v 2.1 1995/02/03 06:01:39 polk Exp */

/*-
 * Copyright (c) 1992 Henry Spencer.
 * Copyright (c) 1992, 1993
[snip]
 *      @(#)regex.h     8.2 (Berkeley) 1/3/94
 */

#ifndef _REGEX_H_
#define _REGEX_H_

#include <sys/cdefs.h>

/* types */
typedef off_t regoff_t;

typedef struct {
        int re_magic;
        size_t re_nsub;         /* number of parenthesized subexpressions */
        __const char *re_endp;  /* end pointer for REG_PEND */
        struct re_guts *re_g;   /* none of your business :-) */
} regex_t;

typedef struct {
        regoff_t rm_so;         /* start of match */
        regoff_t rm_eo;         /* end of match */
} regmatch_t;

/* regcomp() flags */
#define REG_BASIC       0000
#define REG_EXTENDED    0001
#define REG_ICASE       0002
#define REG_NOSUB       0004
#define REG_NEWLINE     0010
#define REG_NOSPEC      0020
#define REG_PEND        0040
#define REG_DUMP        0200

/* regerror() flags */
#define REG_NOMATCH      1
#define REG_BADPAT       2
#define REG_ECOLLATE     3
#define REG_ECTYPE       4
#define REG_EESCAPE      5
#define REG_ESUBREG      6
#define REG_EBRACK       7
#define REG_EPAREN       8
#define REG_EBRACE       9
#define REG_BADBR       10
#define REG_ERANGE      11
#define REG_ESPACE      12
#define REG_BADRPT      13
#define REG_EMPTY       14
#define REG_ASSERT      15
#define REG_INVARG      16
#define REG_ATOI        255     /* convert name to number (!) */
#define REG_ITOA        0400    /* convert number to name (!) */

/* regexec() flags */
#define REG_NOTBOL      00001
#define REG_NOTEOL      00002
#define REG_STARTEND    00004
#define REG_TRACE       00400   /* tracing of execution */
#define REG_LARGE       01000   /* force large representation */
#define REG_BACKR       02000   /* force use of backref code */

__BEGIN_DECLS
int     regcomp __P((regex_t *, const char *, int));
size_t  regerror __P((int, const regex_t *, char *, size_t));
int     regexec __P((const regex_t *,
            const char *, size_t, regmatch_t [], int));
void    regfree __P((regex_t *));
__END_DECLS

#endif /* !_REGEX_H_ */
____________________________________________________________________


> In the meantime, I'll back out the change to the FAQ.

Good idea.

Regards,

Joe
-- 
     _/   _/_/_/       _/              ____________    __o
     _/   _/   _/      _/         ______________     _-\<,_
 _/  _/   _/_/_/   _/  _/                     ......(_)/ (_)
  _/_/ oe _/   _/.  _/_/ ah        [EMAIL PROTECTED]


_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to