Re: const qualifier violation in regex.c:re_comp()

Paul Eggert <[email protected]> Mon, 04 Oct 2004 14:08:57 -0700
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
> Date: Fri, 1 Oct 2004 19:51:00 +0200 (CEST)
> From: Martin Neitzel <[email protected]>
> ...
> Description:
> 	lib/regex.c has a botched const char* (un)qualification.

Can you please explain what is botched about it?  What error messages
did you get when you compiled the unpatched version?  Doesn't IRIX
gettext return "char *"?  If not, what does it return?

> | -	return gettext ("No previous regular expression");
> | +	return gettext_noop ("No previous regular expression");

Thanks, but this fix is incorrect, as it disables translation for a
string that should be translated.

I installed the following patch into gnulib, which should work around
your immediate problem, but I suspect that there's a deeper problem
that should also be looked into.

2004-10-04  Paul Eggert  <[email protected]>

	* regex.c (re_comp): Cast gettext return value to char *,
	Problem reported by Martin Neitzel via Mark D. Baushke.
	
--- regex.c	4 Oct 2004 20:30:46 -0000	1.83
+++ regex.c	4 Oct 2004 21:00:42 -0000	1.84
@@ -7909,7 +7909,7 @@ re_comp (const char *s)
   if (!s)
     {
       if (!re_comp_buf.buffer)
-	return gettext ("No previous regular expression");
+	return (char *) gettext ("No previous regular expression");
       return 0;
     }