Fwd: Bug#584538: libdebian-installer: problems on Hurd with poll()
For your information, my libdebian-installer4 patch.
---------- Forwarded message ----------
From: Jérémie Koenig <jk@jk.fr.eu.org>
Date: 2010/6/4
Subject: Bug#584538: libdebian-installer: problems on Hurd with poll()
To: submit@bugs.debian.org
Package: libdebian-installer4
Version: 0.72
Tags: patch
User: jk@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 <jk@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 <waldi@debian.org>, Colin Watson <cjwatson@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)
Reply to: