Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 41787 invoked from network); 19 Oct 2006 17:05:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Oct 2006 17:05:40 -0000 Received: (qmail 74529 invoked by uid 500); 19 Oct 2006 17:05:39 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 74441 invoked by uid 500); 19 Oct 2006 17:05:39 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 74381 invoked by uid 99); 19 Oct 2006 17:05:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Oct 2006 10:05:39 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [208.30.140.160] (HELO moroha.quovadx.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Oct 2006 10:05:36 -0700 Received: from [10.70.3.48] ([10.70.3.48]) by moroha.quovadx.com (8.13.6/8.13.6) with ESMTP id k9JH4vm1025668 for ; Thu, 19 Oct 2006 17:04:58 GMT Message-ID: <4537B048.8040707@roguewave.com> Date: Thu, 19 Oct 2006 11:05:12 -0600 From: Andrew Black User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060910 SeaMonkey/1.0.5 MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: svn commit: r463535 - in /incubator/stdcxx/trunk: etc/config/makefile.common etc/config/makefile.rules util/cmdopt.cpp util/display.cpp util/output.cpp util/runall.cpp util/target.h References: <20061013004936.5235E1A981A@eris.apache.org> <45300BE8.6010403@roguewave.com> <4530172B.9020801@roguewave.com> <453691F5.4050405@roguewave.com> <4536A3AE.2080102@roguewave.com> <4536ADB7.5000405@roguewave.com> <4536B37E.1040600@roguewave.com> In-Reply-To: <4536B37E.1040600@roguewave.com> Content-Type: multipart/mixed; boundary="------------000707060003090802090903" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------000707060003090802090903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Martin Sebor wrote: [...] > > > $ echo foo; echo bar | wc -l > foo > 1 > > Here's a simple experiment that tries to duplicate what you're > doing in the patch. AFAICT, it doesn't behave the way we want. > What am I missing? > > Martin Ok... What happened was I was focusing on the return code propagation, and overlooked the output. I had assumed that the output was being correctly propagated, as it was being displayed on the console, but this assumption was incorrect. Attached is a different approach to the solution, where the output is redirected to the target log file, then echoed back to the console (and teed to LOGFILE) after the compile/linking completes. A disadvantage of this method is that the output may live in the disk buffer for a time before being flushed. If the system happens to crash during this time, the log will be lost. If the crash was caused by the compiler or linker, this would lead to a loss of potentially useful information. I tried altering things to use a command similar to the following, but the result propagation failed (It seemed to work in bash, but the behavior wasn't quite the same in gmake). { $(COMMAND) 2>&1 ; cache=$$?; } | tee $@.log; (exit $$cache) --Andrew Black --------------000707060003090802090903 Content-Type: text/x-patch; name="warnparse6.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="warnparse6.diff" Index: etc/config/makefile.common =================================================================== --- etc/config/makefile.common (revision 465655) +++ etc/config/makefile.common (working copy) @@ -141,10 +141,16 @@ # file to write log of the build to LOGFILE = /dev/null -# if LOGFILE is being created, tee command output into it +# file target output is logged to (file used in exec utility) +TARGETLOGFILE = $@.log + +# if LOGFILE is not being created, tee command output into TARGETLOGFILE +# otherwise, tee command output into both TARGETLOGFILE and LOGFILE. # IMPORTANT: $(TEEOPTS) must be last on the command line -ifneq ($(LOGFILE),/dev/null) - TEEOPTS = 2>&1 | tee -a $(LOGFILE) +ifeq ($(LOGFILE),/dev/null) + TEEOPTS = >$(TARGETLOGFILE) 2>&1 ; cache=$$?; cat $(TARGETLOGFILE); (exit $$cache) +else + TEEOPTS = >$(TARGETLOGFILE) 2>&1 ; cache=$$?; cat $(TARGETLOGFILE) | tee -a $(LOGFILE); (exit $$cache) endif # determine the name of the results file against which to compute regressions Index: etc/config/makefile.rules =================================================================== --- etc/config/makefile.rules (revision 465655) +++ etc/config/makefile.rules (working copy) @@ -60,16 +60,16 @@ ifneq ($(AS_EXT),".") %.o: %$(AS_EXT) - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< $(TEEOPTS) endif # ifneq ($(AS_EXT),".") endif # ifneq ($(AS_EXT),) %.o: %.cpp - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< $(TEEOPTS) %: %.o - $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) + $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(TEEOPTS) # disable compilation and linking in the same step # %: %.cpp @@ -78,7 +78,7 @@ # compile and link in one step to eliminate the space overhead of .o files %: %.cpp - $(CXX) $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) + $(CXX) $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) $(TEEOPTS) endif # eq ($(NO_DOT_O),) --------------000707060003090802090903--