Received: from eggs.gnu.org ([208.118.235.92]:45951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfNEa-0003QW-Sq for qemu-devel@nongnu.org; Fri, 04 Jan 2019 06:01:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfNEW-0000SG-NW for qemu-devel@nongnu.org; Fri, 04 Jan 2019 06:01:48 -0500 Received: from mail-wm1-f43.google.com ([209.85.128.43]:52756) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gfNEU-0000Q6-Th for qemu-devel@nongnu.org; Fri, 04 Jan 2019 06:01:44 -0500 Received: by mail-wm1-f43.google.com with SMTP id m1so789486wml.2 for ; Fri, 04 Jan 2019 03:01:41 -0800 (PST) References: <1545395783-39040-1-git-send-email-pbonzini@redhat.com> <42d8a1b8-6c33-8e22-b5d9-35f42f6b928e@redhat.com> From: Paolo Bonzini Message-ID: Date: Fri, 4 Jan 2019 12:01:40 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL v4 00/35] Misc patches for 2018-12-21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers On 04/01/19 11:06, Peter Maydell wrote: > On Fri, 4 Jan 2019 at 07:59, Paolo Bonzini wrote: >> >> On 03/01/19 19:37, Peter Maydell wrote: >>> On Sat, 22 Dec 2018 at 08:41, Paolo Bonzini wrote: >>> Interestingly, I have today run into "make: write error: stdout" >>> with the existing make check infrastructure. [...] >>> I presume that something in one of the tests we're running, >>> likely QEMU itself, ends up setting stdout to non-blocking. >>> This while rune *used* to be entirely reliable, so maybe >>> something recent has changed ? >> >> I don't know... I tried running make check under "strace -e fcntl" and I >> didn't find any occurrences of fcntl(1, O_SETFL, ...|O_NONBLOCK). >> Perhaps you can add a check after every invocation of a test executable. > >> Are you going to apply the pull request since the bug is preexisting? > > The pull request takes the problem from "occasionally shows up > in by-hand running of make check in a while loop" to "reliably > causes my automated tests to fail every time". I can't apply > a pullreq that does that, so we need to find at least a workaround. The certain workaround is to clear O_NONBLOCK before invoking make, possibly by placing a wrapper in ~/bin: import os from fcntl import * fcntl(1, F_SETFL, fcntl(1, F_GETFL) & ~os.O_NONBLOCK) If you're using --output-sync, *not* using it might work, but not if the write error occurs when writing the command (as opposed to the output). For what it's worth, I think the latest version of Make is still susceptible when using --output-sync. The loop that flushes the temporary buffer to stdout or stderr is as follows: while (1) { int len; EINTRLOOP (len, read (from, buffer, sizeof (buffer))); if (len < 0) perror ("read()"); if (len <= 0) break; if (fwrite (buffer, len, 1, to) < 1) { perror ("fwrite()"); break; } fflush (to); } Maybe it's one of the dependencies of QEMU that is causing it. Paolo > I'm not sure why your test harness makes it much more likely > that the problem manifests.