On 24/01/17 11:28, Pádraig Brady wrote: > On 22/01/17 02:30, Pádraig Brady wrote: >> On 22/01/17 01:28, Nelson H. F. Beebe wrote: >>> I had done builds of coreutils-8.26 in early December, but did not get >>> around to looking at build logs until today. I now have 166 builds on >>> 138 systems in our lab, of which 81 passed all tests, and 37 passed >>> enough test to be acceptable, so the new version is now installed on >>> most of the machines in my test lab. >>> >>> However, I found a show-stopper source code error here: >>> >>> % sed -n -e 169p src/copy.c >>> #if HAVE_FALLOCATE >>> >>> That is wrong. It needs to be >>> >>> #if defined(HAVE_FALLOCATE) >>> >>> The reason is that on Red Hat 5 and CentOS 5 systems, lib/config.h >>> gets the setting >>> >>> /* #undef HAVE_FALLOCATE */ >>> >>> so HAVE_FALLOCATE is undefined, and expands to an empty string, >>> producing the erroneous preprocessor statement "#if", with no >>> expression. >> >> >> That's a standard idiom though used in other places. >> I.E. it should compile file. We even disable -Wundef to allow >> this common idiom. Is the compile failing here? >> What about other cases like '#if HAVE_FPSETPREC' in numfmt.c? > > What must be happening here is that HAVE_FALLOCATE is defined, > but it's defined to nothing, > You can force the same failure in numfmt for example using: > > $ make CFLAGS=-DHAVE_FPSETPREC= src/numfmt > src/numfmt.c:36:19: error: #if with no expression > > So to find what's defining HAVE_FALLOCATE you could: > > $ rm src/copy.o; make CFLAGS='-E -dD' src/copy.o > $ less src/copy.o
If you tweak src/copy.c to avoid the proprocessor issue, that shows that this issue was introduced with: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.25-68-g89e1fef because that includes <linux/fs.h>, and on kernel-headers-2.6.18-416.el5 at least that defines HAVE_FALLOCATE to nothing. The attached should avoid the issue. cheers, Pádraig
From 698935065b9e26df40dcb8db2da110fac802af46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Wed, 25 Jan 2017 11:09:03 +0000 Subject: [PATCH] build: fix issue with HAVE_FALLOCATE on centos5 * src/copy.c (punch_hole): Work around an empty definition of HAVE_FALLOCATE which leads to a build error of: "error: #if with no expression" That was triggered by the inclusion of <linux/fs.h> in commit v8.25-68-g89e1fef with kernel-headers-2.6.18. Reported by Nelson H. F. Beebe --- src/copy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/copy.c b/src/copy.c index c3d71cb..e3832c2 100644 --- a/src/copy.c +++ b/src/copy.c @@ -75,6 +75,7 @@ # include <linux/falloc.h> #endif +/* See HAVE_FALLOCATE workaround when including this file. */ #ifdef HAVE_LINUX_FS_H # include <linux/fs.h> #endif @@ -166,7 +167,8 @@ static int punch_hole (int fd, off_t offset, off_t length) { int ret = 0; -#if HAVE_FALLOCATE +/* +0 is to work around older <linux/fs.h> defining HAVE_FALLOCATE to empty. */ +#if HAVE_FALLOCATE + 0 # if defined FALLOC_FL_PUNCH_HOLE && defined FALLOC_FL_KEEP_SIZE ret = fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset, length); -- 2.5.5
