On 05/12/11 18:10, Paul Eggert wrote: > On 05/12/11 01:38, Markus Duft wrote: >> this doesn't help, and doesn't even compile, as interix also doesn't have >> sync() > > OK, how about this patch to utimens.c instead?
tested, but doesn't help either. the problem is, that fdutimensat calls utimensat on interix in any case, as futimes always fails (as required functions are missing). utimensat gets passed the 'dir' instead of the 'fd' in fdutimensat, anf this is the reason for fd always being -1 in utimens, and thus i'm not able to sync the file in there without a "sync-all-files" call, which is (again) missing... i'm really forced to do the sync on every open fd. also, maybe you misunderstood something (i think so based on your comment in the patch about NFS): we're not talking about NFS, really here - this is the "normal" filesystem, whatever it may be under the hoods (NTFS, any FAT incarnation, even ext2 with the windows driver). it's just interix itself that is so "incomplete" (not even broken, the existing calls do what i'd expect, but to do what we want, the calls are missing ... :)) while writing this, i just started thinking whether i could introduce another "improvement" to libsuacomp, which already handles a lot of I/O related stuff for me. for example i'm wrapping all read/write/close calls from libc. and (for different reasons), i'm memorizing whenever an fd gets write-dirty, so i could easily implement a sync() that flushes all open fd's that have been written. maybe i could even implement a futimes by memorizing the timestamps and re-setting them after closing the file... would that be better than hacking around in gnulib? libsuacomp is required anyway to get a more sane system. otherwise interix suffers from some quite annoying diseases like throwing around EAGAIN's all the time. Regards, Markus > > diff --git a/lib/utimens.c b/lib/utimens.c > index c190411..f738c68 100644 > --- a/lib/utimens.c > +++ b/lib/utimens.c > @@ -58,6 +58,13 @@ struct utimbuf > # define REPLACE_FUNC_STAT_FILE 0 > #endif > > +/* Interix's NFS implementation seems particularly bug-prone; see > + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00293.html>. */ > +#if __INTERIX > +# define HAVE_BUGGY_NFS_TIME_STAMPS 1 > +static void sync (void) {} > +#endif > + > #if HAVE_UTIMENSAT || HAVE_FUTIMENS > /* Cache variables for whether the utimensat syscall works; used to > avoid calling the syscall if we know it will just fail with ENOSYS,