Bruno Haible wrote: > On Linux/SPARC 64-bit, glibc 2.6.32: > > FAIL: empty > FAIL: fgrep-infloop > FAIL: in-eq-out-infloop
So far I've looked only at the last one. That test is designed to ensure that grep detects when its input file is the same as its output. That it is failing suggests that the same_file_attributes macro is testing too many attributes of a growing file. If we stat the input file and fstat STDOUT_FILENO, between those two events, the file size or mtime may well have changed. We don't want a change like that to make it seem that the files are not the same, so... Of course, other attributes could change then, too, but that's far less likely in any but a very contrived case. Does this fix the problem? >From e2020e347f5669a178f33ca3367ab8de49347347 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Fri, 11 Nov 2011 22:32:31 +0100 Subject: [PATCH] detect more reliably when input and output are the same file * src/system.h (same_file_attributes): Don't test st_size or st_mtime, since those are likely to be changing, and could foil our attempt to detect when input and output are the same file. --- src/system.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/system.h b/src/system.h index e7afc46..9922875 100644 --- a/src/system.h +++ b/src/system.h @@ -88,8 +88,9 @@ enum { EXIT_TROUBLE = 2 }; && (s)->st_nlink == (t)->st_nlink \ && (s)->st_uid == (t)->st_uid \ && (s)->st_gid == (t)->st_gid \ - && (s)->st_size == (t)->st_size \ - && (s)->st_mtime == (t)->st_mtime \ + /* Do not test things that are likely to change in a growing file. */ \ + /* && (s)->st_size == (t)->st_size */ \ + /* && (s)->st_mtime == (t)->st_mtime */ \ && (s)->st_ctime == (t)->st_ctime) #endif -- 1.7.8.rc0.61.g8a042
