Tue 15 Feb 2011 03:34:21 AM UTC, original submission:
This is kind of follow up of
http://www.mail-archive.com/bug-make@gnu.org/msg02239.html
I think this is true bug in gmake for AIX. IBM has support of nanoseconds
https://www-304.ibm.com/support/docview.wss?uid=isg3T1012054
it's kept in st_mtime_n.
As a proof I wrote small program
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>
int main(int argc, char **argv) {
char resolved_path[PATH_MAX];
if (argc != 2) {
printf("Usage: modtime <path>\n");
return 1;
} else {
struct stat fstat = {0};
if (stat(argv[1], &fstat) == 0) {
printf("Mod time=[%d] [%d]\n", fstat.st_mtime, fstat.st_mtime_n);
return 0;
}
if (errno) {
fprintf(stderr, "modtime: %s: %s\n", argv[1], strerror(errno));
return errno;
}
}
return 255;
}
and run 10 times
> for i in 1 2 3 4 5 6 7 8 9;do modtime GNUmakefile;touch GNUmakefile;done
Mod time=[1297728298] [440567462]
Mod time=[1297728301] [911431115]
Mod time=[1297728301] [916699492]
Mod time=[1297728301] [921435220]
Mod time=[1297728301] [931440190]
Mod time=[1297728301] [936699695]
Mod time=[1297728301] [941444402]
Mod time=[1297728301] [951448241]
Mod time=[1297728301] [957170600]
As you can see st_mtime stayed the same, but nano seconds were changed.
In order to fix this we need to do proper check of FILE_TIMESTAMP_HI_RES on aix system in configure and modify filedef.h
#if FILE_TIMESTAMP_HI_RES
#if defined(_IBMCPP_) || defined(AIX) || defined(_AIX)
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
file_timestamp_cons (fname, (st).st_mtime, (st).st_mtime_n)
#else
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
file_timestamp_cons (fname, (st).st_mtime, (st).st_mtim.ST_MTIM_NSEC)
#endif
#else
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
file_timestamp_cons (fname, (st).st_mtime, 0)
#endif
|