Re: 7.4.2 on Solaris 9 - Error - Mailing list pgsql-general

From Joe Conway
Subject Re: 7.4.2 on Solaris 9 - Error
Date
Msg-id 406271CB.8060903@joeconway.com
Whole thread Raw
In response to Re: 7.4.2 on Solaris 9 - Error  (Kris Jurka <books@ejurka.com>)
List pgsql-general
Kris Jurka wrote:
> This problem was just recently fixed in cvs and will go out in the 7.4.3
> release.  For no your best bet is to checkout the 7.4 branch from cvs, or
> search the pgsql-committers archives to find the patch you need to apply.

I just recently went through installing 7.4.2 on Solaris. The attached
two patches did the trick for me (and both should match the tip of the
7.4 stable branch).

HTH,

Joe

*** src/port/thread.c.orig    Mon Mar 22 18:24:17 2004
--- src/port/thread.c    Mon Mar 22 18:24:45 2004
***************
*** 116,122 ****
       * Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
       *    getpwuid_r(uid, resultbuf, buffer, buflen)
       */
!     result = getpwuid_r(uid, resultbuf, buffer, buflen);
  #endif
  #else

--- 116,122 ----
       * Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
       *    getpwuid_r(uid, resultbuf, buffer, buflen)
       */
!     *result = getpwuid_r(uid, resultbuf, buffer, buflen);
  #endif
  #else

Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.310.2.8
diff -c -c -r1.310.2.8 configure
*** configure    5 Mar 2004 19:57:18 -0000    1.310.2.8
--- configure    20 Mar 2004 15:36:01 -0000
***************
*** 13484,13489 ****
--- 13484,13548 ----

  CFLAGS="$_CFLAGS"
  LIBS="$_LIBS"
+ echo "$as_me:$LINENO: checking whether getpwuid_r takes a fifth argument" >&5
+ echo $ECHO_N "checking whether getpwuid_r takes a fifth argument... $ECHO_C" >&6
+ if test "${pgac_func_getpwuid_r_5arg+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <pwd.h>
+ #ifdef F77_DUMMY_MAIN
+ #  ifdef __cplusplus
+      extern "C"
+ #  endif
+    int F77_DUMMY_MAIN() { return 1; }
+ #endif
+ int
+ main ()
+ {
+ uid_t uid;
+ struct passwd *space;
+ char *buf;
+ size_t bufsize;
+ struct passwd **result;
+ getpwuid_r(uid, space, buf, bufsize, result);
+   ;
+   return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } &&
+          { ac_try='test -s conftest.$ac_objext'
+   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+   (eval $ac_try) 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; }; then
+   pgac_func_getpwuid_r_5arg=yes
+ else
+   echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ pgac_func_getpwuid_r_5arg=no
+ fi
+ rm -f conftest.$ac_objext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $pgac_func_getpwuid_r_5arg" >&5
+ echo "${ECHO_T}$pgac_func_getpwuid_r_5arg" >&6
+ if test x"$pgac_func_getpwuid_r_5arg" = xyes ; then
+
+ cat >>confdefs.h <<\_ACEOF
+ #define GETPWUID_R_5ARG
+ _ACEOF
+
+ fi
+
  fi


Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.301.2.6
diff -c -c -r1.301.2.6 configure.in
*** configure.in    5 Mar 2004 19:57:20 -0000    1.301.2.6
--- configure.in    20 Mar 2004 15:36:02 -0000
***************
*** 1061,1066 ****
--- 1061,1067 ----
  AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
  CFLAGS="$_CFLAGS"
  LIBS="$_LIBS"
+ PGAC_FUNC_GETPWUID_R_5ARG
  fi


Index: config/c-library.m4
===================================================================
RCS file: /cvsroot/pgsql-server/config/c-library.m4,v
retrieving revision 1.23
diff -c -c -r1.23 c-library.m4
*** config/c-library.m4    23 Jul 2003 23:30:39 -0000    1.23
--- config/c-library.m4    20 Mar 2004 15:36:03 -0000
***************
*** 73,78 ****
--- 73,101 ----
  ])# PGAC_FUNC_GETTIMEOFDAY_1ARG


+ # PGAC_FUNC_GETPWUID_R_5ARG
+ # ---------------------------
+ # Check if getpwuid_r() takes a fifth argument (later POSIX standard, not draft version)
+ # If so, define GETPWUID_R_5ARG
+ AC_DEFUN([PGAC_FUNC_GETPWUID_R_5ARG],
+ [AC_CACHE_CHECK(whether getpwuid_r takes a fifth argument,
+ pgac_func_getpwuid_r_5arg,
+ [AC_TRY_COMPILE([#include <sys/types.h>
+ #include <pwd.h>],
+ [uid_t uid;
+ struct passwd *space;
+ char *buf;
+ size_t bufsize;
+ struct passwd **result;
+ getpwuid_r(uid, space, buf, bufsize, result);],
+ [pgac_func_getpwuid_r_5arg=yes],
+ [pgac_func_getpwuid_r_5arg=no])])
+ if test x"$pgac_func_getpwuid_r_5arg" = xyes ; then
+   AC_DEFINE(GETPWUID_R_5ARG,, [Define to 1 if getpwuid_r() takes a 5th argument.])
+ fi
+ ])# PGAC_FUNC_GETPWUID_R_5ARG
+
+
  # PGAC_UNION_SEMUN
  # ----------------
  # Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
Index: src/include/pg_config.h.in
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/pg_config.h.in,v
retrieving revision 1.64.2.2
diff -c -c -r1.64.2.2 pg_config.h.in
*** src/include/pg_config.h.in    11 Feb 2004 17:32:09 -0000    1.64.2.2
--- src/include/pg_config.h.in    20 Mar 2004 15:36:04 -0000
***************
*** 43,48 ****
--- 43,51 ----
     (--enable-thread-safety) */
  #undef ENABLE_THREAD_SAFETY

+ /* Define to 1 if getpwuid_r() takes a 5th argument. */
+ #undef GETPWUID_R_5ARG
+
  /* Define to 1 if gettimeofday() takes only 1 argument. */
  #undef GETTIMEOFDAY_1ARG

Index: src/port/thread.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/thread.c,v
retrieving revision 1.12.2.3
diff -c -c -r1.12.2.3 thread.c
*** src/port/thread.c    14 Mar 2004 14:01:54 -0000    1.12.2.3
--- src/port/thread.c    20 Mar 2004 15:36:05 -0000
***************
*** 107,120 ****
             size_t buflen, struct passwd **result)
  {
  #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)
      /*
       * Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
       *    getpwuid_r(uid, resultbuf, buffer, buflen)
-      * Do we need to support it?  bjm 2003-08-14
       */
!     /* POSIX version */
!     getpwuid_r(uid, resultbuf, buffer, buflen, result);
!
  #else

  #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
--- 107,123 ----
             size_t buflen, struct passwd **result)
  {
  #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)
+
+ #ifdef GETPWUID_R_5ARG
+     /* POSIX version */
+     getpwuid_r(uid, resultbuf, buffer, buflen, result);
+ #else
      /*
       * Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
       *    getpwuid_r(uid, resultbuf, buffer, buflen)
       */
!     result = getpwuid_r(uid, resultbuf, buffer, buflen);
! #endif
  #else

  #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)

pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: self referencing tables/ nested sets etc...
Next
From: Gunasekaran Balakrishnan
Date:
Subject: conversion_create.sql (Related to BUG#1072)