From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#10044: "warning: reader_thread.SetEvent failed with 6 for fd -1" and accessing fd_info[-1] Date: Mon, 14 Nov 2011 16:33:42 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1321284941 30770 80.91.229.12 (14 Nov 2011 15:35:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 14 Nov 2011 15:35:41 +0000 (UTC) To: 10044@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 14 16:35:35 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RPyZK-0002c8-Ta for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Nov 2011 16:35:35 +0100 Original-Received: from localhost ([::1]:45798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPyZK-0003p0-8T for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Nov 2011 10:35:34 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPyZH-0003ot-Jh for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:35:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPyZG-0003mM-8K for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:35:31 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPyZG-0003mE-34 for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:35:30 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RPyZn-0004pb-FQ for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:36:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Nov 2011 15:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10044 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: X-Debbugs-Original-To: Bug-Gnu-Emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.132128494718545 (code B ref -1); Mon, 14 Nov 2011 15:36:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Nov 2011 15:35:47 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RPyZU-0004p0-2M for submit@debbugs.gnu.org; Mon, 14 Nov 2011 10:35:47 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RPyZP-0004on-Mq for submit@debbugs.gnu.org; Mon, 14 Nov 2011 10:35:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPyYl-0003bq-DK for submit@debbugs.gnu.org; Mon, 14 Nov 2011 10:35:00 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:46142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPyYl-0003bm-9T for submit@debbugs.gnu.org; Mon, 14 Nov 2011 10:34:59 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPyYk-0003jr-09 for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:34:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPyYf-0003a6-3J for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:34:57 -0500 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:63170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPyYe-0003Zo-O8 for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2011 10:34:52 -0500 Original-Received: by ggnq1 with SMTP id q1so3101804ggn.0 for ; Mon, 14 Nov 2011 07:34:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=tII416Uz3CxeIFJSWyDdd4lAI+QpHl2w3MG0nipUh6s=; b=ctrvk9cmE8pvOu/F6w/mC6lFDi4o+L8jwTd0MJWXJbtf17Oxf3RT6r1E7uy9x8dK+G CVs0hkxx0XP+GHpSnGjvpYZfsfi10N3RdZZ5ONhQ9GxMlEzhNcXcUYHTFmNL88FZmCbE r0KjyuUsnCYDIw0doLkAlJ3OPLLvN+vMiTWBA= Original-Received: by 10.68.30.164 with SMTP id t4mr19171467pbh.63.1321284863104; Mon, 14 Nov 2011 07:34:23 -0800 (PST) Original-Received: by 10.142.48.12 with HTTP; Mon, 14 Nov 2011 07:33:42 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 14 Nov 2011 10:36:03 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:53897 Archived-At: Package: emacs,w32 Severity: minor (gdb) run -Q --eval "(shell-command \"dir\")" Starting program: c:\emacs\debug\bin\emacs.exe -Q --eval "(shell-command \"dir\")" [New Thread 5948.0x17a4] [New Thread 5948.0x9c8] [New Thread 5948.0x4b4] [New Thread 5948.0x16ac] warning: reader_thread.SetEvent failed with 6 for fd -1 which can not be right, because it happens in this bit of code of w32proc.c:reader_thread(): /* Our identity */ cp = (child_process *)arg; /* We have to wait for the go-ahead before we can start */ if (cp == NULL || WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0) return 1; for (;;) { int rc; if (fd_info[cp->fd].flags & FILE_LISTEN) rc = _sys_wait_accept (cp->fd); else rc = _sys_read_ahead (cp->fd); /* The name char_avail is a misnomer - it really just means the read-ahead has completed, whether successfully or not. */ if (!SetEvent (cp->char_avail)) { DebPrint (("reader_thread.SetEvent failed with %lu for fd %ld\n", GetLastError (), cp->fd)); return 1; } [...] which means that cp->fd is being used as an index into fd_info[], and the choice between _sys_wait_accept and _sys_read_ahead is bogus. IIUC, cp->fd == -1 means that the wait was intended, but no input is expected, so I think the following patch is enough: === modified file 'src/w32proc.c' --- src/w32proc.c 2011-06-24 21:25:22 +0000 +++ src/w32proc.c 2011-11-14 15:19:09 +0000 @@ -241,7 +241,8 @@ /* We have to wait for the go-ahead before we can start */ if (cp == NULL - || WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0) + || WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0 + || cp->fd < 0) return 1; for (;;)