[bug #40056] make should automatically detect targets with low resolution timestamps

2014-03-03 Thread Paul D. Smith
Follow-up Comment #6, bug #40056 (project make):

I will definitely fix this before the next release.

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?40056

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #40056] make should automatically detect targets with low resolution timestamps

2013-09-22 Thread Paul D. Smith
Follow-up Comment #1, bug #40056 (project make):

Philip Guether writes on the bug-make mailing list:


You're looking for
pathconf(path, _PC_TIMESTAMP_RESOLUTION)

See also:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html

However, last I checked glibc and Linux didn't implement it.


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?40056

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #40056] make should automatically detect targets with low resolution timestamps

2013-09-17 Thread James Ralston
URL:
  http://savannah.gnu.org/bugs/?40056

 Summary: make should automatically detect targets with low
resolution timestamps
 Project: make
Submitted by: ralston
Submitted on: Wed 18 Sep 2013 05:12:18 AM GMT
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: SCM
Operating System: POSIX-Based
   Fixed Release: None
   Triage Status: None

___

Details:

We use make on our Red Hat Enterprise Linux systems, using the ext3 and (now)
ext4 filesystems.

While the stat(2) call on Linux has supported nanosecond resolution timestamps
since kernel 2.5.48, and the autoconf/configure script for make properly
detects high resolution timestamp support, the ext3 filesystem has no support
for actually storing nanosecond timestamps, while the ext4 filesystem does.

So, when the source of a make rule is on ext4, and the target is on ext3, make
will always think that the target is older than the source, because the
target's timestamp will have the nanosecond resolution truncated. This has
been biting us since we introduced ext4 into our environment.

We know about the .LOW_RESOLUTION_TIME special target. But using
.LOW_RESOLUTION_TIME is both 1) intractable and 2) wrong.

Our environment has hundreds of extremely complex Makefiles with many rules
and many targets. Since we cannot reliably know whether any arbitrary target
will ultimately reside on an ext3 or ext4 filesystem, we would have to set the
.LOW_RESOLUTION_TIME target for *every* target, and always remember to do so
for every future target. This is impractical to the point of being
impossible.

The fundamental issue here is that kernel *and* filesystem support is
necessary to support high resolution timestamps. On some systems, these are
one and the same, but on GNU/Linux systems, they are completely independent
qualities. The former can be detected at compile time, but the latter can only
be detected at run time. The current code correctly does the former, but does
not do the latter.

The statfs(2) system call will return the f_type field in the struct statfs,
but unfortunately, the field is the same for all variants of ext (ext2, ext3,
ext4). So as far as I know (although I would be happy to be corrected), there
is no library or system call that will reveal whether the filesystem that an
arbitrary file is on supports high resolution timestamps.

However, all is not lost: one can infer that a file is stored on a filesystem
that lacks high resolution timestamps by the fact that the nanosecond
component of the timestamp is zero.

Given that, I would propose the following change to make's timestamp
comparison behavior: if the OS supports high resolution timestamps, but the
value of a target file's nanosecond timestamp is 0, then make implicitly
applies the .LOW_RESOLUTION_TIME special target to the target file.

In the vast majority of cases, this would obviate the need to explicitly use
the .LOW_RESOLUTION_TIME special target, as make will automatically detect
when the target has a low resolution timestamp.

I searched both the bug lists and the mailing list archives, and I didn't see
any previous discussion specific to this issue, so I've attached a patch to
implement this behavior. Is there any reason why it cannot be applied?



___

File Attachments:


---
Date: Wed 18 Sep 2013 05:12:18 AM GMT  Name: make.patch  Size: 2kB   By:
ralston
patch to automatically apply .LOW_RESOLUTION_TIME as necessary
http://savannah.gnu.org/bugs/download.php?file_id=29170

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?40056

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: [bug #40056] make should automatically detect targets with low resolution timestamps

2013-09-17 Thread Philip Guenther
On Tue, Sep 17, 2013 at 10:12 PM, James Ralston invalid.nore...@gnu.org wrote:
...
 The statfs(2) system call will return the f_type field in the struct statfs,
 but unfortunately, the field is the same for all variants of ext (ext2, ext3,
 ext4). So as far as I know (although I would be happy to be corrected), there
 is no library or system call that will reveal whether the filesystem that an
 arbitrary file is on supports high resolution timestamps.

You're looking for
pathconf(path, _PC_TIMESTAMP_RESOLUTION)

See also:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html

However, last I checked glibc and Linux didn't implement it.


Philip Guenther

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make