NetBSD Problem Report #49092

From  Fri Aug  8 21:34:51 2014
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer "Postmaster" (verified OK))
	by (Postfix) with ESMTPS id B9136A8857
	for <>; Fri,  8 Aug 2014 21:34:51 +0000 (UTC)
Message-Id: <>
Date: Sat,  9 Aug 2014 00:34:46 +0300 (EEST)
From: Jarmo Jaakkola <>
Reply-To: Jarmo Jaakkola <>
Subject: make(1): output ordering changes when stdout is a file or pipe
X-Send-Pr-Version: 3.95

>Number:         49092
>Category:       toolchain
>Synopsis:       make(1): output is not properly flushed after a failure is ignored
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 08 21:35:00 +0000 2014
>Last-Modified:  Sat Aug 23 14:55:01 +0000 2014
>Originator:     Jarmo Jaakkola <>
>Release:        NetBSD 6.1.2_PATCH
System: NetBSD 6.1.2_PATCH NetBSD 6.1.2_PATCH (KOTOISA) #5: Mon Jan 20 17:01:44 EET 2014 amd64
Architecture: x86_64
Machine: amd64
When make is invoked with -k, a message about an ignored command failure
is output only after output from the next command has been printed if
stdout is a file or a pipe.  I'd assume this occurs because stdout is
line buffered if it is associated with terminal and block buffered otherwise.
The message being newline terminated and printing fine on terminal certainly
suggests that.
$ cat >Makefile <<EOF
all: first second
	@echo 'Next line should be: "*** Error code 1 (continuing)"'
	@echo "Next line should be: \"\`all' not remade because of errors.\""

$ make -k
Next line should be: "*** Error code 1 (continuing)"
*** Error code 1 (continuing)
Next line should be: "`all' not remade because of errors."
`all' not remade because of errors.

$ make -k >log; cat log
Next line should be: "*** Error code 1 (continuing)"
Next line should be: "`all' not remade because of errors."
*** Error code 1 (continuing)
`all' not remade because of errors.

$ make -k | cat
Next line should be: "*** Error code 1 (continuing)"
Next line should be: "`all' not remade because of errors."
*** Error code 1 (continuing)
`all' not remade because of errors.
If stdout is flushed after the error message, the output is in correct
order.  Would it make sense to explicitly set the buffering strategy
on stdout in case there are other problems like this?  Anyway, here's
where you would do the flush.

--- usr.bin/make/compat.c.old
+++ usr.bin/make/compat.c
@@ -475,6 +475,7 @@
 		    status = 0;
+	    fflush(stdout);
 	} else {
 	    Fatal("error in wait: %d: %s", retstat, strerror(errno));

From: "Christos Zoulas" <>
Subject: PR/49092 CVS commit: src
Date: Sat, 23 Aug 2014 10:50:24 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sat Aug 23 14:50:24 UTC 2014

 Modified Files:
 	src/usr.bin/make: make.1 parse.c var.c
 Added Files:
 	src/tests/usr.bin/make: d_posix.out

 Log Message:
 PR/49085: Jarmo Jaakkola: fix several parsing errors

 Don't exit from var.c:Var_Parse() before possible modifiers are handled
 on D and F modified versions of local variables.  Properly expand $(?D)
 and $(?F) too.

 Make line continuations in rule's commands POSIX compliant.

 Fix the syntax error caused by lib(member) as the last target before
 a dependency operator.

 Document the line continuation change in the manual page.  Also talk
 more about the POSIX style local variables and their modifiers.

 Add tests covering the fixed problems into  The test is
 a known failure at the moment because of PR 49086 and PR 49092.

 [XXX: unconverted tests]

 To generate a diff of this commit:
 cvs rdiff -u -r0 -r1.3 src/tests/usr.bin/make/ \
 cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/make/
 cvs rdiff -u -r1.230 -r1.231 src/usr.bin/make/make.1
 cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/parse.c
 cvs rdiff -u -r1.186 -r1.187 src/usr.bin/make/var.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.