On Fri, Sep 23, 2011 at 08:31:00AM -0700, acampbell wrote: > This sounds rather like what I am experiencing, tbough not identical. > I am using vim-7.3 in xmonad. If I start gvim from a terminal it locks > up, and I get these messages: > > ------------------------------------------------------------------------------------ > E852: The child process failed to start the GUI > > [xcb] Unknown sequence number while processing queue > > [xcb] Most likely this is a multi-threaded client and XInitThreads has > not been called > > [xcb] Aborting, sorry about that. > gvim: ../../src/xcb_io.c:273: poll_for_event: Assertion > `!xcb_xlib_threads_sequence_lost' failed. > ----------------------------------------------------------------------------
The fact that you're getting E852 means you have Tim's patch applied. I saw some similar crashes on one of my systems and the attached patch seems to fix the problem. Can you see if it also fixes the problem for you? I'm not entirely sure why switching from fread/fwrite to normal read/write fixes it, especially since I don't see the problem on all of my systems. I have a feeling it's related to the lseek that the fdopen does on the pipe fd (which causes a SIGPIPE), though. -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
diff --git a/src/gui.c b/src/gui.c
--- a/src/gui.c
+++ b/src/gui.c
@@ -212,7 +212,6 @@
int status;
int exit_status;
pid_t pid = -1;
- FILE *parent_file;
/* Setup a pipe between the child and the parent, so that the parent
* knows when the child has done the setsid() call and is allowed to
@@ -290,19 +289,17 @@
gui_mch_forked();
# endif
- if (!pipe_error)
- parent_file = fdopen(pipefd[1], "w");
- else
- parent_file = NULL;
-
/* Try to start the GUI */
gui_attempt_start();
/* Notify the parent */
- if (parent_file != NULL)
+ if (!pipe_error)
{
- fputs(gui.in_use ? "ok" : "fail", parent_file);
- fclose(parent_file);
+ if (gui.in_use)
+ write_eintr(pipefd[1], "ok", 3);
+ else
+ write_eintr(pipefd[1], "fail", 5);
+ close(pipefd[1]);
}
/* If we failed to start the GUI, exit now. */
@@ -323,17 +320,19 @@
static int
gui_read_child_pipe(int fd)
{
- size_t bytes_read;
- FILE *file;
- char buffer[10];
-
- file = fdopen(fd, "r");
- if (!file)
+ ssize_t bytes_read;
+#define READ_BUFFER_SIZE 10
+ char buffer[READ_BUFFER_SIZE];
+
+ bytes_read = read_eintr(fd, buffer, READ_BUFFER_SIZE-1);
+#undef READ_BUFFER_SIZE
+ if (bytes_read == -1)
+ {
+ close(fd);
return GUI_CHILD_IO_ERROR;
-
- bytes_read = fread(buffer, sizeof(char), sizeof(buffer)-1, file);
+ }
buffer[bytes_read] = '\0';
- fclose(file);
+ close(fd);
if (strcmp(buffer, "ok") == 0)
return GUI_CHILD_OK;
return GUI_CHILD_FAILED;
signature.asc
Description: Digital signature
