Correctly check for HAVE_STAT_BIRTHTIME in configure.ac checks for System.Native...
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 23 Sep 2019 20:44:59 +0000 (22:44 +0200)
committerGitHub <noreply@github.com>
Mon, 23 Sep 2019 20:44:59 +0000 (22:44 +0200)
The check was done incorrectly, the include files need to be separated by newlines otherwise we would get a false negative result.

config.log contained this:

```
conftest.c:279:23: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include <sys/types.h>, #include <sys/stat.h>
                      ^
                      //
```

This means that when doing File.GetCreationTime() we'd fall back to returning the last modified time.

It regressed when we switched to System.IO.File to the CoreFX implementation i.e. System.Native in https://github.com/mono/mono/commit/mono/mono@8f5cef936491e8b20888bbf18d426482c890637c.

Fixes https://github.com/mono/mono/issues/16974

Commit migrated from https://github.com/mono/mono/commit/9b98db9ca949bbb706a3d647662985347816d9f7

src/mono/configure.ac

index f034565..6f429b2 100644 (file)
@@ -3400,13 +3400,29 @@ if test x$host_win32 = xno; then
        AC_CHECK_DECL(ICANON,            [AC_DEFINE(HAVE_ICANON, 1, [ICANON])], [], [[#include <termios.h>]])
        AC_CHECK_DECL(TCSANOW,           [AC_DEFINE(HAVE_TCSANOW, 1, [TCSANOW])], [], [[#include <termios.h>]])
 
-       AC_CHECK_MEMBER(struct stat.st_birthtimespec, [AC_DEFINE(HAVE_STAT_BIRTHTIME, 1, [struct stat.st_birthtime])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
-       AC_CHECK_MEMBER(struct stat.st_atimespec,     [AC_DEFINE(HAVE_STAT_TIMESPEC, 1, [struct stat.st_atimespec])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
-       AC_CHECK_MEMBER(struct stat.st_atim,          [AC_DEFINE(HAVE_STAT_TIM, 1, [struct stat.st_atim])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
-       AC_CHECK_MEMBER(struct stat.st_atimensec,     [AC_DEFINE(HAVE_STAT_NSEC, 1, [struct stat.st_atimensec])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
-       AC_CHECK_MEMBER(struct dirent.d_namlen,       [AC_DEFINE(HAVE_DIRENT_NAME_LEN, 1, [struct dirent.d_namlen])], [], [[#include <dirent.h>]])
-       AC_CHECK_MEMBER(struct statfs.f_fstypename,   [AC_DEFINE(HAVE_STATFS_FSTYPENAME, 1, [struct statfs.f_fstypename])], [], [[#include <sys/mount.h>]])
-       AC_CHECK_MEMBER(struct statvfs.f_fstypename,  [AC_DEFINE(HAVE_STATVFS_FSTYPENAME, 1, [struct statvfs.f_fstypename])], [], [[#include <sys/mount.h>]])
+       AC_CHECK_MEMBER(struct stat.st_birthtimespec,
+               [AC_DEFINE(HAVE_STAT_BIRTHTIME, 1, [struct stat.st_birthtimespec])],
+               [],
+               [#include <sys/types.h>
+               #include <sys/stat.h>])
+       AC_CHECK_MEMBER(struct stat.st_atimespec,
+               [AC_DEFINE(HAVE_STAT_TIMESPEC, 1, [struct stat.st_atimespec])],
+               [],
+               [#include <sys/types.h>
+               #include <sys/stat.h>])
+       AC_CHECK_MEMBER(struct stat.st_atim,
+               [AC_DEFINE(HAVE_STAT_TIM, 1, [struct stat.st_atim])],
+               [],
+               [#include <sys/types.h>
+               #include <sys/stat.h>])
+       AC_CHECK_MEMBER(struct stat.st_atimensec,
+               [AC_DEFINE(HAVE_STAT_NSEC, 1, [struct stat.st_atimensec])],
+               [],
+               [#include <sys/types.h>
+               #include <sys/stat.h>])
+       AC_CHECK_MEMBER(struct dirent.d_namlen,       [AC_DEFINE(HAVE_DIRENT_NAME_LEN, 1, [struct dirent.d_namlen])], [], [#include <dirent.h>])
+       AC_CHECK_MEMBER(struct statfs.f_fstypename,   [AC_DEFINE(HAVE_STATFS_FSTYPENAME, 1, [struct statfs.f_fstypename])], [], [#include <sys/mount.h>])
+       AC_CHECK_MEMBER(struct statvfs.f_fstypename,  [AC_DEFINE(HAVE_STATVFS_FSTYPENAME, 1, [struct statvfs.f_fstypename])], [], [#include <sys/mount.h>])
 
        AC_MSG_CHECKING(for struct statfs)
        AC_TRY_COMPILE([