From owner-freebsd-ports@FreeBSD.ORG Wed May 6 19:25:01 2009 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08BAE1065694 for ; Wed, 6 May 2009 19:25:01 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 6E8A58FC1D for ; Wed, 6 May 2009 19:25:00 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: (qmail invoked by alias); 06 May 2009 19:24:51 -0000 Received: from e179171104.adsl.alicedsl.de (EHLO mandree.no-ip.org) [85.179.171.104] by mail.gmx.net (mp007) with SMTP; 06 May 2009 21:24:51 +0200 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX19Dy5Y5/pFDM9d3m3LPAd6bWWOa/GbDmgPOMHb9UZ QKsykjeCnWRUe8 Received: from vmfreebsd6.emma.line.org (vmfreebsd6.emma.line.org [192.168.0.106]) by merlin.emma.line.org (Postfix) with ESMTP id 1C00119402E; Wed, 6 May 2009 21:24:40 +0200 (CEST) Received: by vmfreebsd6.emma.line.org (Postfix, from userid 1001) id 5A385417D9; Wed, 6 May 2009 21:24:38 +0200 (CEST) Date: Wed, 6 May 2009 21:24:38 +0200 From: Matthias Andree To: bug-followup@FreeBSD.org Message-ID: <20090506192438.GA69779@vmfreebsd6.emma.line.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.68 Cc: freebsd-ports@freebsd.org, miwi@freebsd.org Subject: [MAINTAINER] Re: ports/134156: Unable to build updated: e2fsprogs-libuuid-1.41.5 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2009 19:25:01 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline [resent with patch] Greetings, the attached patch changes two ports and should fix this bug. * misc/e2fsprogs-libuuid: - bump revision, as we're changing files and fixing a bug even for those who had successfully built libuuid before - patch one more source file to make sure the clock.txt state file gets saved to the right directory - try to run the newly-build uuidd for our self-test (ignoring failures, as they are non-fatal) - (the actual build fix is inherited from the other port) * sysutils/e2fsprogs: - add files/patch-uuid-loop to actually fix the "self-test does not terminate" bug. What causes the client to see EOF prematurely or the server to fail to send a response remains unknown, but we'll fix the worse part of the issue: loop on EOF (read returning 0). diffstat: misc/e2fsprogs-libuuid/Makefile | 9 +- misc/e2fsprogs-libuuid/files/uuidd.in | 8 +- sysutils/e2fsprogs/files/patch-uuid-loop | 117 +++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 5 deletions(-) -- Matthias Andree --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p1 --- /usr/ports/misc/e2fsprogs-libuuid/Makefile 2009-04-26 00:25:12.000000000 +0200 +++ /usr/home/ma/ports/misc/e2fsprogs-libuuid/Makefile 2009-05-06 19:56:38.000000000 +0200 @@ -5,7 +5,7 @@ # $FreeBSD: ports/misc/e2fsprogs-libuuid/Makefile,v 1.9 2009/04/25 22:25:12 miwi Exp $ # -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= misc devel PKGNAMESUFFIX= -libuuid @@ -38,14 +38,17 @@ post-patch:: ${REINPLACE_CMD} -e 's,/var/lib/libuuid,/var/run/libuuid,g' \ -e 's,/usr/sbin/uuidd,${PREFIX}/sbin/uuidd,' \ - ${WRKSRC}/lib/uuid/uuidd.h + ${WRKSRC}/lib/uuid/*.[ch] pre-build: ${MKDIR} ${WRKSRC}/lib/uuid/elfshared +# ulimit guards against runaway tests +# failure to launch uuidd is fine (one might be running, or we may lack +# privileges); if it works, it'll quit after 50 seconds post-build: cd ${WRKSRC}/misc && ${MAKE} uuidgen uuidgen.1 uuidd uuidd.8 - cd ${INSTALL_WRKSRC} && ${MAKE} check + ( ulimit -t 5 ; cd ${INSTALL_WRKSRC} && { ../../misc/uuidd -T50 || true ; ${MAKE} check ; } ) post-install: ${INSTALL_PROGRAM} ${WRKSRC}/misc/uuidgen ${PREFIX}/bin/ --- /usr/ports/misc/e2fsprogs-libuuid/files/uuidd.in 2008-05-07 00:29:03.000000000 +0200 +++ /usr/home/ma/ports/misc/e2fsprogs-libuuid/files/uuidd.in 2009-05-06 20:17:00.000000000 +0200 @@ -1,9 +1,13 @@ #!/bin/sh # # rcNG script to start uuidd at boot-time on rcNG-enabled systems, -# such as FreeBSD. +# such as FreeBSD. Note: Starting uuidd at boot-time is not strictly +# necessary, the library will - as of 1.41.5 - silently launch an +# instance of uuidd that exits after 300 seconds; for most accurate +# time-based uuids generated from unprivileged user accounts it may be +# useful to run it system-wide. # -# (C) 2008 by Matthias Andree. +# (C) 2008, 2009 by Matthias Andree. # Licensed under the modified (= 2-clause) BSD license. # PROVIDE: uuidd --- /usr/ports/sysutils/e2fsprogs/files/patch-uuid-loop 1970-01-01 01:00:00.000000000 +0100 +++ /usr/home/ma/ports/sysutils/e2fsprogs/files/patch-uuid-loop 2009-05-06 20:19:28.000000000 +0200 @@ -0,0 +1,117 @@ + Fix and factor out read_all(). + + read_all() does not treat 0 (EOF indicator) properly and goes into an + unterminated loop, assuming blocking read. + + Fix: Instead, return 0 if it cannot fulfill the request, because it sees + a premature EOF. + +--- /dev/null ++++ b/lib/read_all.h +@@ -0,0 +1,32 @@ ++/* ++ * read_all - a read variant that masks EAGAIN and EINTR. ++ * This function tries hard to make sure to read the complete requested ++ * length, and if it hits EOF while reading, it returns 0. ++ * ++ * Originally written by Theodore Y. Ts'o. ++ * Factored out from misc/uuidd.c and lib/uuid/gen_uuid.c ++ * and bugfixed by Matthias Andree, 2009. ++ */ ++ ++ssize_t read_all(int fd, char *buf, size_t count) ++{ ++ ssize_t ret; ++ ssize_t c = 0; ++ ++ memset(buf, 0, count); ++ while (count > 0) { ++ ret = read(fd, buf, count); ++ if (ret == -1) { ++ if ((errno == EAGAIN) || (errno == EINTR)) ++ continue; ++ return -1; ++ } ++ if (ret == 0) { ++ return c; ++ } ++ count -= ret; ++ buf += ret; ++ c += ret; ++ } ++ return c; ++} +--- a/lib/uuid/Makefile.in ++++ b/lib/uuid/Makefile.in +@@ -190,7 +190,7 @@ clear.o: $(srcdir)/clear.c $(srcdir)/uuidP.h $(srcdir)/uuid.h + compare.o: $(srcdir)/compare.c $(srcdir)/uuidP.h $(srcdir)/uuid.h + copy.o: $(srcdir)/copy.c $(srcdir)/uuidP.h $(srcdir)/uuid.h + gen_uuid.o: $(srcdir)/gen_uuid.c $(srcdir)/uuidP.h $(srcdir)/uuid.h \ +- $(srcdir)/uuidd.h ++ $(srcdir)/uuidd.h $(top_srcdir)/lib/read_all.h + isnull.o: $(srcdir)/isnull.c $(srcdir)/uuidP.h $(srcdir)/uuid.h + pack.o: $(srcdir)/pack.c $(srcdir)/uuidP.h $(srcdir)/uuid.h + parse.o: $(srcdir)/parse.c $(srcdir)/uuidP.h $(srcdir)/uuid.h +--- a/lib/uuid/gen_uuid.c ++++ b/lib/uuid/gen_uuid.c +@@ -415,25 +415,11 @@ try_again: + return 0; + } + +-static ssize_t read_all(int fd, char *buf, size_t count) +-{ +- ssize_t ret; +- ssize_t c = 0; +- +- memset(buf, 0, count); +- while (count > 0) { +- ret = read(fd, buf, count); +- if (ret < 0) { +- if ((errno == EAGAIN) || (errno == EINTR)) +- continue; +- return -1; +- } +- count -= ret; +- buf += ret; +- c += ret; +- } +- return c; +-} ++/* ++ * Import read_all function and make it static. ++ */ ++static ++#include "read_all.h" + + /* + * Close all file descriptors +--- a/misc/uuidd.c ++++ b/misc/uuidd.c +@@ -85,25 +85,8 @@ static void create_daemon(void) + die("setreuid"); + } + +-static int read_all(int fd, char *buf, size_t count) +-{ +- ssize_t ret; +- int c = 0; +- +- memset(buf, 0, count); +- while (count > 0) { +- ret = read(fd, buf, count); +- if (ret < 0) { +- if ((errno == EAGAIN) || (errno == EINTR)) +- continue; +- return -1; +- } +- count -= ret; +- buf += ret; +- c += ret; +- } +- return c; +-} ++static ++#include "read_all.h" + + static int write_all(int fd, char *buf, size_t count) + { --BOKacYhQ+x31HxR3--