Re: Bug#584538: libdebian-installer: problems on Hurd with poll()
On Sun, Aug 01, 2010 at 05:02:47PM +0200, Samuel Thibault wrote: Hello, Hi, Jérémie Koenig, le Fri 04 Jun 2010 14:41:34 +0200, a écrit : On Hurd, libdebian-installer gets stuck inside the internal_di_exec() function. This is caused by the way poll() reports end-of-file, which cannot be portably relied on. The attach patch uses feof() instead of POLLHUP to detect it. Index: packages/libdebian-installer/src/exec.c === --- packages/libdebian-installer/src/exec.c (revision 63370) +++ packages/libdebian-installer/src/exec.c (working copy) @@ -162,14 +162,12 @@ { bool exit = false; +/* Implementations of poll() deliver various combinations of POLLIN and + POLLHUP on EOF. fgets() detects it and we check with feof() below. + References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ for (i = 0; i pipes; i++) { -/* References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ -#if defined(__FreeBSD_kernel__) - if ((pollfds[i].revents POLLIN) (! (pollfds[i].revents POLLHUP))) -#else - if (pollfds[i].revents POLLIN) -#endif + if (pollfds[i].revents (POLLIN | POLLHUP)) { while (fgets (line, sizeof (line), files[i].file) != NULL) { @@ -180,8 +178,8 @@ len--; } files[i].handler (line, len, io_user_data); + exit = true; } -exit = true; } } @@ -189,7 +187,7 @@ continue; for (i = 0; i pipes; i++) - if (pollfds[i].revents POLLHUP) + if (feof(files[i].file)) exit = true; if (exit) This seems simpler to me. Could BSD people check they do not have bad effects? I have just made a test and this version seems to work perfectly on GNU/kFreeBSD. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net -- To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20100804183853.gt4...@hall.aurel32.net
Re: Bug#584538: libdebian-installer: problems on Hurd with poll()
Hello, Jérémie Koenig, le Fri 04 Jun 2010 14:41:34 +0200, a écrit : On Hurd, libdebian-installer gets stuck inside the internal_di_exec() function. This is caused by the way poll() reports end-of-file, which cannot be portably relied on. The attach patch uses feof() instead of POLLHUP to detect it. Index: packages/libdebian-installer/src/exec.c === --- packages/libdebian-installer/src/exec.c (revision 63370) +++ packages/libdebian-installer/src/exec.c (working copy) @@ -162,14 +162,12 @@ { bool exit = false; +/* Implementations of poll() deliver various combinations of POLLIN and + POLLHUP on EOF. fgets() detects it and we check with feof() below. + References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ for (i = 0; i pipes; i++) { -/* References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ -#if defined(__FreeBSD_kernel__) - if ((pollfds[i].revents POLLIN) (! (pollfds[i].revents POLLHUP))) -#else - if (pollfds[i].revents POLLIN) -#endif + if (pollfds[i].revents (POLLIN | POLLHUP)) { while (fgets (line, sizeof (line), files[i].file) != NULL) { @@ -180,8 +178,8 @@ len--; } files[i].handler (line, len, io_user_data); + exit = true; } -exit = true; } } @@ -189,7 +187,7 @@ continue; for (i = 0; i pipes; i++) - if (pollfds[i].revents POLLHUP) + if (feof(files[i].file)) exit = true; if (exit) This seems simpler to me. Could BSD people check they do not have bad effects? Samuel -- To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20100801150247.gn4...@const.famille.thibault.fr
Bug#584538: libdebian-installer: problems on Hurd with poll()
Package: libdebian-installer4 Version: 0.72 Tags: patch User: j...@jk.fr.eu.org Usertags: gsoc2010 Hello, On Hurd, libdebian-installer gets stuck inside the internal_di_exec() function. This is caused by the way poll() reports end-of-file, which cannot be portably relied on. The attach patch uses feof() instead of POLLHUP to detect it. Though it's somewhat unrelated, it also disables short-circuiting doxygen on Hurd, which does not apply any more and makes the package fail to build because of missing files in debian/tmp/usr/share/doc. -- Jérémie Koenig j...@jk.fr.eu.org http://jk.fr.eu.org/ Index: packages/libdebian-installer/debian/control === --- packages/libdebian-installer/debian/control (revision 63370) +++ packages/libdebian-installer/debian/control (working copy) @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian Install System Team debian-boot@lists.debian.org Uploaders: Bastian Blank wa...@debian.org, Colin Watson cjwat...@debian.org -Build-Depends: dpkg-dev (= 1.13.5), debhelper (= 7.3.0~), autotools-dev, doxygen [!hurd-i386] +Build-Depends: dpkg-dev (= 1.13.5), debhelper (= 7.3.0~), autotools-dev, doxygen Standards-Version: 3.8.1 Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/libdebian-installer Index: packages/libdebian-installer/debian/rules === --- packages/libdebian-installer/debian/rules (revision 63370) +++ packages/libdebian-installer/debian/rules (working copy) @@ -21,9 +21,7 @@ override_dh_auto_build: dh_auto_build -ifneq ($(DEB_HOST_ARCH_OS),hurd) $(MAKE) -C build/doc doc -endif override_dh_clean: ifneq $(wildcard /usr/share/misc/config.sub) Index: packages/libdebian-installer/src/exec.c === --- packages/libdebian-installer/src/exec.c (revision 63370) +++ packages/libdebian-installer/src/exec.c (working copy) @@ -162,14 +162,12 @@ { bool exit = false; +/* Implementations of poll() deliver various combinations of POLLIN and + POLLHUP on EOF. fgets() detects it and we check with feof() below. + References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ for (i = 0; i pipes; i++) { -/* References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ -#if defined(__FreeBSD_kernel__) - if ((pollfds[i].revents POLLIN) (! (pollfds[i].revents POLLHUP))) -#else - if (pollfds[i].revents POLLIN) -#endif + if (pollfds[i].revents (POLLIN | POLLHUP)) { while (fgets (line, sizeof (line), files[i].file) != NULL) { @@ -180,8 +178,8 @@ len--; } files[i].handler (line, len, io_user_data); + exit = true; } -exit = true; } } @@ -189,7 +187,7 @@ continue; for (i = 0; i pipes; i++) - if (pollfds[i].revents POLLHUP) + if (feof(files[i].file)) exit = true; if (exit)