tag 608220 patch
thanks

Jakub Wilk <jw...@debian.org> (28/12/2010):
> Source: hugs98
> Version: 98.200609.21-5
> Severity: serious
> Justification: rebuild produces a broken package
>
> I rebuilt hugs98 in a clean sid i386 chroot. The package was built
> successfully, but the resulting libhugs-network-bundled was mostly
> empty:
>
> $ dpkg -c libhugs-network-bundled_98.200609.21-5_i386.deb | grep -v -E 
> '/($|usr/share/doc)'
> -rw-r--r-- root/root       605 2010-12-18 15:20 
> ./usr/lib/hugs/packages/network/autogen/Paths_network.hs
>
> The interesting part of the build log:
>
> | Preprocessing library network-2.0...
> | ../../libraries/tools/hsc2hs -D__HUGS__ -Iinclude -DCALLCONV=ccall -o 
> Network/BSD.hs Network/BSD.hsc
> | ../../libraries/tools/hsc2hs -D__HUGS__ -Iinclude -DCALLCONV=ccall -o 
> Network/Socket.hs Network/Socket.hsc
> | Socket.hsc: In function 'main':
> | Socket.hsc:1002: error: invalid application of 'sizeof' to incomplete type 
> 'struct ucred'
> | Socket.hsc:1002: error: invalid application of 'sizeof' to incomplete type 
> 'struct ucred'
> | Socket.hsc:1002: error: invalid application of 'sizeof' to incomplete type 
> 'struct ucred'
> | Socket.hsc:1008: error: invalid use of undefined type 'struct ucred'
> | Socket.hsc:1009: error: invalid use of undefined type 'struct ucred'
> | Socket.hsc:1010: error: invalid use of undefined type 'struct ucred'
> | compiling Network/Socket_hsc_make.c failed

This seems to go away once the attached patch applied.

KiBi.
diff -u hugs98-98.200609.21/debian/changelog hugs98-98.200609.21/debian/changelog
--- hugs98-98.200609.21/debian/changelog
+++ hugs98-98.200609.21/debian/changelog
@@ -1,3 +1,14 @@
+hugs98 (98.200609.21-5.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Improve SO_PEERCRED/struct ucred detection by applying a patch stolen
+    from haskell-network's 64a3779811dd9965d864c8b9c85c49a261c4eb69. This
+    fixes the build with glibc 2.8 and higher (Closes: #608220). As a
+    reminder, the build ought to break with such compiler errors, instead
+    of creating mostly-empty packages, as noted by Jakub Wilk.
+
+ -- Cyril Brulebois <k...@debian.org>  Fri, 31 Dec 2010 16:40:14 +0100
+
 hugs98 (98.200609.21-5) unstable; urgency=low
 
   * configure.ac: temporarily add ${Hugs}/libraries to the search path of
only in patch2:
unchanged:
--- hugs98-98.200609.21.orig/packages/network/network.buildinfo.in
+++ hugs98-98.200609.21/packages/network/network.buildinfo.in
@@ -1,4 +1,4 @@
-ghc-options: -dcallco...@callconv@
-cc-options: -dcallco...@callconv@
+ghc-options: -dcallco...@callconv@ @EXTRA_CPPFLAGS@
+cc-options: -dcallco...@callconv@ @EXTRA_CPPFLAGS@
 c-sources: @EXTRA_SRCS@
 extra-libraries: @EXTRA_LIBS@
only in patch2:
unchanged:
--- hugs98-98.200609.21.orig/packages/network/configure.ac
+++ hugs98-98.200609.21/packages/network/configure.ac
@@ -50,6 +50,39 @@
  [ AC_DEFINE([HAVE_BSD_SENDFILE], [1], [Define to 1 if you have a BSDish sendfile(2) implementation.]) AC_MSG_RESULT(yes) ],
  AC_MSG_RESULT(no))
 
+dnl --------------------------------------------------
+dnl * test for SO_PEERCRED and struct ucred
+dnl --------------------------------------------------
+AC_MSG_CHECKING(for SO_PEERCRED and struct ucred in sys/socket.h)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <sys/socket.h>
+#ifndef SO_PEERCRED
+# error no SO_PEERCRED
+#endif
+struct ucred u;]])],ac_cv_ucred=yes,ac_cv_ucred=no)
+if test "x$ac_cv_ucred" = xno; then
+    old_CFLAGS="$CFLAGS"
+    CFLAGS="-D_GNU_SOURCE $CFLAGS"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <sys/socket.h>
+#ifndef SO_PEERCRED
+# error no SO_PEERCRED
+#endif
+struct ucred u;]])],ac_cv_ucred=yes,ac_cv_ucred=no)
+    if test "x$ac_cv_ucred" = xyes; then
+        EXTRA_CPPFLAGS=-D_GNU_SOURCE
+    fi
+else
+    old_CFLAGS="$CFLAGS"
+fi
+if test "x$ac_cv_ucred" = xno; then
+    CFLAGS="$old_CFLAGS"
+    AC_MSG_RESULT(no)
+else
+    AC_DEFINE([HAVE_STRUCT_UCRED], [1], [Define to 1 if you have both SO_PEERCRED and struct ucred.])
+    AC_MSG_RESULT(yes)
+fi
+
 AC_CHECK_FUNCS(gethostent)
 
 case "$host" in
@@ -67,6 +100,7 @@
 	CALLCONV=ccall ;;
 esac
 AC_SUBST([CALLCONV])
+AC_SUBST([EXTRA_CPPFLAGS])
 AC_SUBST([EXTRA_LIBS])
 AC_SUBST([EXTRA_SRCS])
 
only in patch2:
unchanged:
--- hugs98-98.200609.21.orig/packages/network/Network/Socket.hsc
+++ hugs98-98.200609.21/packages/network/Network/Socket.hsc
@@ -69,7 +69,7 @@
     getPeerName,	-- :: Socket -> IO SockAddr
     getSocketName,	-- :: Socket -> IO SockAddr
 
-#ifdef SO_PEERCRED
+#ifdef HAVE_STRUCT_UCRED
 	-- get the credentials of our domain socket peer.
     getPeerCred,         -- :: Socket -> IO (CUInt{-pid-}, CUInt{-uid-}, CUInt{-gid-})
 #endif
@@ -992,7 +992,7 @@
        fromIntegral `liftM` peek ptr_v
 
 
-#ifdef SO_PEERCRED
+#ifdef HAVE_STRUCT_UCRED
 -- | Returns the processID, userID and groupID of the socket's peer.
 --
 -- Only available on platforms that support SO_PEERCRED on domain sockets.

Attachment: signature.asc
Description: Digital signature

Reply via email to