bug-make
[Top][All Lists]
Advanced

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

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


From: James Ralston
Subject: [bug #40056] make should automatically detect targets with low resolution timestamps
Date: Wed, 18 Sep 2013 05:12:19 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.6.24-1.fc14 Firefox/3.6.24

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/




reply via email to

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