[620] in Zephyr_Bugs
regcomp problems in solaris 2 (zephyr 2.0 beta 2) with fix
daemon@ATHENA.MIT.EDU (E. Jay Berkenbilt)
Mon Jul 10 14:08:16 1995
Date: Mon, 10 Jul 1995 14:04:55 -0400
From: "E. Jay Berkenbilt" <ejb@ERA.COM>
To: bug-zephyr@MIT.EDU
Well, I grabbed zephyr 2.0 beta 2, and problems I previously reported
but one seem to be fixed. That problem is the failures in regcomp in
regexp.c in clients/zwgc. I had previously reported this without a
fix and had just #ifdef'ed out the error messages for beta 1. I
determined that the problem was not erroneous error messages as I had
originally suspected but actually failure of the regcomp routine.
Upon running a small test program, I determined that a call to regcomp
on solaris 2 returns -1 which is defined in regex.h as "function not
supported". I could also find no mention of regcomp in any manual
page under solaris 2.
The enclosed patch is a better fix. This includes an autoconf test to
test whether regcomp works. The test is only run if regcomp is found.
If it passes, REGCOMP_WORKS is defined. Then, in sysdep.h, if
HAVE_REGCOMP is defined but REGCOMP_WORKS is not, then HAVE_REGCOMP is
#undef'ed. The appropriate entry for REGCOMP_WORKS was also added to
acconfig.h. After making this change, I built zephyr on Solaris 1,
Solaris 2, Linux, HPUX 9, and IRIX 5. Of these platforms,
HAVE_REGCOMP is defined under Linux, Solaris 2, and HPUX.
REGCOMP_WORKS, on the other hand, is defined only on HPUX. Given this
patch, zwgc works AND does regular expressions in zwgc.desc properly
on all five platforms.
BTW, in order to run autoheader, I had to pull h/zephyr/zephyr.h out
of AC_CONFIG_HEADER and stick it in AC_OUTPUT instead. There is
nothing in h/zephyr/zephyr.h.in requires it to be in AC_CONFIG_HEADER
anyway, and an h/zephyr/zephyr.h that was older than zephyr.h.in was
included in the distribution. Was h/zephyr/zehpyr.h listed under
AC_CONFIG_HEADER because of oversight, or is there a reason it should
be there? In any case, that change is also included in this patch.
(For the moment, I am also running autoconf 2.3, but I will probably
install 2.4 soon.)
You will have to run autoreconf after applying this patch since I did
not include changes to configure or h/config.h.in resulting from these
changes to configure.in (though I did manually inspect the changes and
test them).
I hope you will consider inclusion of this change in the final zephyr
2.0.
--
E. Jay Berkenbilt (ejb@ERA.COM) | Member, League for Programming Freedom
Engineering Research Associates | lpf@uunet.uu.net, http://www.lpf.org
===========================================================================
--- h/sysdep.h.dist Fri Jul 7 23:15:49 1995
+++ h/sysdep.h Mon Jul 10 12:55:23 1995
@@ -193,5 +193,9 @@
#define MSG_BSIZE BUFSIZ
#endif
+#if defined(HAVE_REGCOMP) && !defined(REGCOMP_WORKS)
+#undef HAVE_REGCOMP
+#endif
+
#endif /* __SYSDEP_H__ */
--- configure.in.dist Fri Jul 7 23:02:37 1995
+++ configure.in Mon Jul 10 13:15:35 1995
@@ -165,8 +165,38 @@
AC_CHECK_FUNCS(putenv regcomp re_comp strchr memcpy memmove waitpid getlogin)
AC_CHECK_FUNCS(strerror random lrand48 gethostid krb_get_err_text krb_log)
-AC_CONFIG_HEADER(h/config.h h/zephyr/zephyr.h)
-AC_OUTPUT(Makefile clients/Makefile clients/syslogd/Makefile
+if test "$ac_cv_func_regcomp" = "yes"; then
+ AC_MSG_CHECKING(whether regcomp works)
+ AC_CACHE_VAL(zephyr_cv_sys_regcomp_works,
+ [AC_TRY_RUN([
+#include <regex.h>
+int main()
+{
+ regex_t RE;
+ int retval;
+ char errbuf[512];
+
+ retval = regcomp(&RE, "[Ff]rom:", REG_EXTENDED|REG_NOSUB);
+ if (retval != 0) {
+ exit(1);
+ }
+ else{
+ exit(0);
+ }
+}
+ ],
+ zephyr_cv_sys_regcomp_works=yes,
+ zephyr_cv_sys_regcomp_works=no)])
+ if test "$zephyr_cv_sys_regcomp_works" = "yes"; then
+ AC_DEFINE(REGCOMP_WORKS)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+AC_CONFIG_HEADER(h/config.h)
+AC_OUTPUT(h/zephyr/zephyr.h Makefile clients/Makefile clients/syslogd/Makefile
clients/xzwrite/Makefile clients/zaway/Makefile clients/zctl/Makefile
clients/zleave/Makefile clients/zlocate/Makefile
clients/zmailnotify/Makefile clients/znol/Makefile
--- acconfig.h.dist Fri Jul 7 17:53:22 1995
+++ acconfig.h Mon Jul 10 12:50:31 1995
@@ -19,3 +19,6 @@
/* Define to the type of the host system. */
#define MACHINE_TYPE "unknown"
+/* Define if `regcomp' works. */
+#undef REGCOMP_WORKS
+