Menu

#180 output files have truncated mtimes, may appear older than their inputs

autogen
closed
None
1
2020-09-14
2016-12-10
No

Hello,

this is http://bugs.debian.org/847633 submitted by Mike Miller.

AutoGen appears to truncate the mtimes of its output files, so the
generated .c and .h files appear to be older than they actually are.

This can be a serious problem in timestamp-based build systems, in
particular if the input file to AutoGen is itself generated by the build
system.

I'll give a trivial example that demonstrates the effect I have run
into:

$ cat args.def
autogen definitions options;
prog-name     = test;
prog-title    = "Test Program";

flag = {
  name = debug;
  value = d;
};
$ rm -f args.c args.h
$ touch args.def && sleep 0.2 && autogen args.def
$ stat -c "%y %n" args.* | sort -n
2016-12-09 19:21:52.000000000 -0800 args.c
2016-12-09 19:21:52.000000000 -0800 args.h
2016-12-09 19:21:52.530084232 -0800 args.def

As you can see, the AutoGen input file args.def has an actual timestamp,
while args.[ch] have timestamps that are truncated and artificially
older than that of args.def. The --source-time option doesn't matter
here, unless of course the "sleep 0.2" is turned into "sleep 2". The
sleep here is just to emulate other build steps or wait states, and to
emphasize that the args.def file is in fact up to date when it is read
by AutoGen.

If this sequence of commands were part of a make-based build system, and
args.def were in turn generated from args.def.in, make would be left
with files that it thinks are out of date.

I don't know why AutoGen is intentionally truncating the mtime of its
outputs. The only reference to manipulating mtime that I've seen is the
--source-time option, which does (close to) what it describes, but also
truncates the mtime so that it is again always older than the mtime of
the source file.

So it basically seems like AutoGen always munges the output file time
stamps, and knows nothing about subsecond resolution.

Discussion

  • Bruce Korb

    Bruce Korb - 2016-12-15

    Guilty. The interface available in the '90s did not include sub-second time. I need to update it and cope with platforms without the new interface.

     
  • Bruce Korb

    Bruce Korb - 2017-08-13

    WOW !!! It took half a day to work it out. Non-trivial. I'll send a preliminary version in private email to do a bit of sanity checking before release.

     
  • Bruce Korb

    Bruce Korb - 2017-08-13
    • status: open --> accepted
    • assigned_to: Bruce Korb
     
  • Bruce Korb

    Bruce Korb - 2017-09-11
    • status: accepted --> pending
     
  • Bruce Korb

    Bruce Korb - 2017-09-11

    Patch applied. pending release.

     
  • Mike Miller

    Mike Miller - 2017-10-01

    Thank you very much for taking the time to work on a fix for this!

     
  • Bruce Korb

    Bruce Korb - 2020-09-14
    • status: pending --> closed
     
  • Bruce Korb

    Bruce Korb - 2020-09-14

    fixed

     

Log in to post a comment.