[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: touch gets stuck for named pipes

From: Bruno Haible
Subject: Re: touch gets stuck for named pipes
Date: Thu, 9 Apr 2009 11:48:21 +0200
User-agent: KMail/1.9.9

Pádraig Brady wrote:
> So would this simplification be appropriate, which just handles systems
> where utime("file", &ut); is OK while utime("file", NULL); is not?

Often, when files are exported over NFS, the server and the client have
different clocks. The write() call assigns to the file the current time
of the server, while the proposed code assigns it the current time of the
client. Thus it's a change in behaviour.

> How likely is that though, and is ftruncate() more likely
> to be missing than utime()?

See gnulib/doc/posix-functions/{ftruncate,utime}.texi: Both functions are
present on all Unix systems, and both are missing on mingw.

> >> Because I'm crosscompiling HAVE_WORKING_UTIMES is always unset. Exporting
> >> gl_cv_func_working_utimes solved this for me,

This is the main problem: autoconf guessed wrong. The AC_FUNC_UTIME_NULL macro
is already obsolete for 3 years:

     If `utime (FILE, NULL)' sets FILE's timestamp to the present,
     define `HAVE_UTIME_NULL'.

     This macro is obsolescent, as all current systems have a `utime'
     that behaves this way.  New programs need not use this macro.

I propose to either
  a) Change the cross-compiling default in m4/utime.m4 to
     "ac_cv_func_utime_null=yes", or
  b) Remove the 'utime' module altogether.

In case a), one can think of adding a test for the type of the file,
right after fstat, (S_ISREG || S_ISBLK). But that is of secondary importance.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]