[gnutls-devel] portability problem in gnutls-3.2.7: rpl_strerror missing

Thomas Klausner wiz at NetBSD.org
Fri Nov 29 23:54:42 CET 2013


On Fri, Nov 29, 2013 at 11:45:41PM +0100, Nikos Mavrogiannopoulos wrote:
> On Fri, 2013-11-29 at 23:14 +0100, Thomas Klausner wrote:
> > On Fri, Nov 29, 2013 at 07:03:20PM +0100, Andreas Metzler wrote:
> > > http://lists.gnupg.org/pipermail/gnutls-devel/2013-November/006588.html
> > 
> > Thanks.
> > 
> > I tried what the post suggests, but still get:
> > ../lib/.libs/libgnutls.so: undefined reference to `rpl_strerror'
> > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > ../lib/.libs/libgnutls.so: undefined reference to `rpl_strerror'
> > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > Makefile:1832: recipe for target 'srptool' failed
> > gmake[4]: *** [srptool] Error 1
> 
> Indeed. I missed nettle/rnd.c. It also calls strerror(). Apart from
> those two I don't see it in any other files.

Thanks. Using the attached two patches gnutls compiles for me again.

Btw, please fix the test(1) '==' usage in configure.ac -- only bash
test(1) supports that, everywhere else it's just '='. (patch attached)

Thanks,
 Thomas
-------------- next part --------------
$NetBSD$

http://lists.gnupg.org/pipermail/gnutls-devel/2013-November/006588.html

--- lib/nettle/egd.c.orig	2013-11-10 17:59:14.000000000 +0000
+++ lib/nettle/egd.c
@@ -155,12 +155,10 @@ int _rndegd_connect_socket(void)
 
 	fd = socket(LOCAL_SOCKET_TYPE, SOCK_STREAM, 0);
 	if (fd == -1) {
-		_gnutls_debug_log("can't create unix domain socket: %s\n",
-				  strerror(errno));
+		_gnutls_debug_log("can't create unix domain socket\n");
 		return -1;
 	} else if (connect(fd, (struct sockaddr *) &addr, addr_len) == -1) {
-		_gnutls_debug_log("can't connect to EGD socket `%s': %s\n",
-				  name, strerror(errno));
+		_gnutls_debug_log("can't connect to EGD socket `%s'\n", name);
 		close(fd);
 		fd = -1;
 	}
@@ -202,13 +200,11 @@ int _rndegd_read(int *fd, void *_output,
 	buffer[1] = nbytes;
 
 	if (do_write(*fd, buffer, 2) == -1)
-		_gnutls_debug_log("can't write to the EGD: %s\n",
-				  strerror(errno));
+		_gnutls_debug_log("can't write to the EGD\n");
 
 	n = do_read(*fd, buffer, 1);
 	if (n == -1) {
-		_gnutls_debug_log("read error on EGD: %s\n",
-				  strerror(errno));
+		_gnutls_debug_log("read error on EGD\n");
 		do_restart = 1;
 		goto restart;
 	}
@@ -217,8 +213,7 @@ int _rndegd_read(int *fd, void *_output,
 	if (n) {
 		n = do_read(*fd, buffer, n);
 		if (n == -1) {
-			_gnutls_debug_log("read error on EGD: %s\n",
-					  strerror(errno));
+			_gnutls_debug_log("read error on EGD\n");
 			do_restart = 1;
 			goto restart;
 		}
@@ -240,12 +235,10 @@ int _rndegd_read(int *fd, void *_output,
 		buffer[0] = 2;	/* blocking */
 		buffer[1] = nbytes;
 		if (do_write(*fd, buffer, 2) == -1)
-			_gnutls_debug_log("can't write to the EGD: %s\n",
-					  strerror(errno));
+			_gnutls_debug_log("can't write to the EGD\n");
 		n = do_read(*fd, buffer, nbytes);
 		if (n == -1) {
-			_gnutls_debug_log("read error on EGD: %s\n",
-					  strerror(errno));
+			_gnutls_debug_log("read error on EGD\n");
 			do_restart = 1;
 			goto restart;
 		}
-------------- next part --------------
$NetBSD$

http://lists.gnupg.org/pipermail/gnutls-devel/2013-November/006588.html

--- lib/nettle/rnd.c.orig	2013-11-10 17:59:14.000000000 +0000
+++ lib/nettle/rnd.c
@@ -90,8 +90,7 @@ static int do_trivia_source(int init)
 	memcpy(&event.now, &current_time, sizeof(event.now));
 #ifdef HAVE_GETRUSAGE
 	if (getrusage(RUSAGE_SELF, &event.rusage) < 0) {
-		_gnutls_debug_log("getrusage failed: %s\n",
-				  strerror(errno));
+		_gnutls_debug_log("getrusage failed\n");
 		abort();
 	}
 #endif
@@ -244,8 +243,7 @@ static int do_device_source_urandom(int 
 			if (res <= 0) {
 				if (res < 0) {
 					_gnutls_debug_log
-					    ("Failed to read /dev/urandom: %s\n",
-					     strerror(errno));
+					    ("Failed to read /dev/urandom\n");
 				} else {
 					_gnutls_debug_log
 					    ("Failed to read /dev/urandom: end of file\n");
-------------- next part --------------
$NetBSD$

--- configure.ac.orig	2013-11-23 10:04:09.000000000 +0000
+++ configure.ac
@@ -347,7 +347,7 @@ fi
 AM_CONDITIONAL(ENABLE_TROUSERS, test "$with_tpm" != "no")
 
 LIBOPTS_CHECK([src/libopts])
-if test "$NEED_LIBOPTS_DIR" == "true";then
+if test "$NEED_LIBOPTS_DIR" = "true";then
 	dnl delete libopts-generated files
 	for i in ${srcdir}/src/*-args.c.bak ${srcdir}/src/*-args.h.bak; do
 		nam=`echo $i|sed 's/.bak//g'`


More information about the Gnutls-devel mailing list