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
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);