Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 72793 invoked from network); 7 Aug 2006 21:11:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Aug 2006 21:11:56 -0000 Received: (qmail 95327 invoked by uid 500); 7 Aug 2006 21:11:56 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 95269 invoked by uid 500); 7 Aug 2006 21:11:56 -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 95257 invoked by uid 99); 7 Aug 2006 21:11:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Aug 2006 14:11:56 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (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; Mon, 07 Aug 2006 14:11:55 -0700 Received: from [10.70.3.48] ([10.70.3.48]) by moroha.quovadx.com (8.13.6/8.13.4) with ESMTP id k77LBKu5006871 for ; Mon, 7 Aug 2006 21:11:20 GMT Message-ID: <44D7AC85.3070107@roguewave.com> Date: Mon, 07 Aug 2006 15:11:33 -0600 From: Andrew Black User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060720 SeaMonkey/1.0.3 MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: [patch]Re: examples in OUTPUT state References: <44D3F3FC.8070007@roguewave.com> In-Reply-To: <44D3F3FC.8070007@roguewave.com> Content-Type: multipart/mixed; boundary="------------050600020000060900090900" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------050600020000060900090900 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Greetings all. Attached is a short patch that should resolve this issue. The cause of the error was that the output was smaller than the static holding buffer, so the call to memcmp was comparing beyond the amount of data that had been read into the buffer. This in turn was leading to a difference in the unfilled portions of the buffer. This difference was caused by the natural variations in uninitialized memory. --Andrew Black Martin Sebor wrote: > There are a bunch of examples that the exec utility reports as > having failed with the OUTPUT status even though when executed > by hand they run successfully to completion and produce the > expected output. I suspect there must be a bug in the utility. > > $ make auto_ptr run; ./auto_ptr > auto_ptr.out && diff auto_ptr.out > /build/sebor/stdcxx/examples/manual/out/auto_ptr.out; echo $? > make: `auto_ptr' is up to date. > NAME STATUS ASSERTS FAILED PERCNT > auto_ptr OUTPUT > 0 > > Martin --------------050600020000060900090900 Content-Type: text/x-patch; name="shortdelta.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="shortdelta.diff" Index: output.cpp =================================================================== --- output.cpp (revision 429465) +++ output.cpp (working copy) @@ -296,6 +296,10 @@ size_t out_read, ref_read; int match = 1; + /* Zero out holding buffers to avoid false differences */ + memset (out_buf, 0, DELTA_BUF_LEN); + memset (ref_buf, 0, DELTA_BUF_LEN); + while (!feof (reference) && !feof (output)) { /* First, read a block from the files into the buffer */ out_read = fread (out_buf, DELTA_BUF_LEN, 1, output); --------------050600020000060900090900--