[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [elinks-dev] The Links/Links2/ELinks browsers are unusable on Debian GNU/Hurd

Kalle Olavi Niemitalo <kon@iki.fi> writes:

> It seems to me that you Hurd people have three ways to fix this:

Until you have a proper fix, you might also patch ELinks to work
around the bug.  The following patch causes RPCs that are in
principle unnecessary, but perhaps they won't slow things down
too much.  Changing the set_handlers calls to pass NULLs would
be more efficient, but there are a few variables where it is not
trivial to figure out statically whether the file descriptor
refers to a pipe or rather a socket, so I think this way is safer.

If there is a public ID for this bug, I'd like to mention it 
in "Supported platforms" at <http://elinks.cz/about.html>,
and in a comment in set_handlers.

diff --git a/src/main/select.c b/src/main/select.c
index aab5349..382e609 100644
--- a/src/main/select.c
+++ b/src/main/select.c
@@ -10,6 +10,9 @@
 #include <sys/signal.h>
+#ifdef __GNU__ /* For GNU Hurd bug workaround in set_handlers */
+#include <sys/stat.h> /* OS/2 needs this after sys/types.h */
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -146,6 +149,19 @@ set_handlers(int fd, select_handler_T read_func, select_handler_T write_func,
 		fd, FD_SETSIZE);
 	if_assert_failed return;
+#ifdef __GNU__
+	/* As of 2007-12, GNU/Hurd has a bug: if ELinks does a
+	 * select() where the initial exceptfds set includes a pipe
+	 * that is not listed in the other fd_sets, then select()
+	 * always reports an exception there.  To work around this
+	 * bug, do not monitor exceptions for pipes on the Hurd.  */
+	if (error_func) {
+		struct stat st;
+		if (fstat(fd, &st) == 0 && S_ISFIFO(st.st_mode))
+			error_func = NULL;
+	}
 	threads[fd].read_func = read_func;
 	threads[fd].write_func = write_func;
 	threads[fd].error_func = error_func;

Attachment: pgprIIgB4ycs2.pgp
Description: PGP signature

Reply to: