Donate Share

AutoGen: The Automated Program Generator

Tracker: Bugs

5 Bad Mtime on Output Files from --no-definitions Run - ID: 2875281
Last Update: Comment added ( eric_mcdonald )

Running Autogen with the --no-definitions option causes an output file's
mtime to be an empty value (i.e., immediately before midnight of
1970/01/01). One implication of this is that 'make' will always attempt to
rebuild a target constructed with this option.

Symptoms:
$ make
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -L
../../../AUTOGEN-LIB -s impl_c -s impl_h ../AGD/test.agd
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -T
sdlcurses.agt --no-definitions -b sdlcurses --not-writable
$ ls -l sdlcurses.h test.h-frag
-r--r--r-- 1 eric users 2052 Dec 31 1969 sdlcurses.h
-r--r--r-- 1 eric users 1545 Oct 8 20:13 test.h-frag
$ make
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -T
sdlcurses.agt --no-definitions -b sdlcurses --not-writable
$ ls -l sdlcurses.h test.h-frag
-r--r--r-- 1 eric users 2052 Dec 31 1969 sdlcurses.h
-r--r--r-- 1 eric users 1545 Oct 8 20:13 test.h-frag

Attached is a patch that changes the behavior so that the current time is
imprinted as the output file's mtime. With this patch applied the above
symptoms are resolved:

$ make
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -T
sdlcurses.agt --no-definitions -b sdlcurses --not-writable
$ ls -l sdlcurses.h test.h-frag
-r--r--r-- 1 eric users 2052 Oct 8 20:29 sdlcurses.h
-r--r--r-- 1 eric users 1545 Oct 8 20:13 test.h-frag
$ make
make: Nothing to be done for `all'.

Thanks.


Eric McDonald ( eric_mcdonald ) - 2009-10-09 00:44

5

Closed

Fixed

Bruce Korb

autogen

autogen

Public


Comments ( 8 )

Date: 2009-10-10 20:44
Sender: eric_mcdonald

Looks good, sir. Thank you.


Date: 2009-10-10 16:51
Sender: bkorbProject AdminAccepting Donations

So, my apologies for all the noise. It's been a long time since I looked
at the mod time stuff. By default, --source-time _is_ disabled. It
wasn't
for --no-definitions by mistake (bug). So, setting the time where you
did
needs to be done, but conditionally:
if (! ENABLED_OPT( SOURCE_TIME ))
outTime = time( NULL );
and the other stuff discovered needs fixing, too. All done. 5.9.10pre9
I'm done playing today. Cheers - Bruce


Date: 2009-10-10 16:41
Sender: bkorbProject AdminAccepting Donations

For your purposes, consider using: --no-source-time
or: export AUTOGEN_SOURCE_TIME=no
or: echo no-source-time >> ~/.autogenrc


Date: 2009-10-10 16:33
Sender: eric_mcdonald

I definitely agree about the configurable - something that will allow an
Autogen user to always get the current time as the output file mtimes, no
matter the mtimes of the definitions file, templates, extraction sources,
or Scheme library in use. Do you want me to file this as a feature request?


Date: 2009-10-10 16:07
Sender: bkorbProject AdminAccepting Donations

Yep. The extraction stuff has an effect, too. The correct thing is using
some sort
of file fingerprint and not using time stamps at all. That's out of
scope, though.
Here, my intention is to remove the move-if-change problem that typically
gets
solved with a script by that name. Setting the result modification time
needs to
be some sort of configurable.....Thanks


Date: 2009-10-10 15:48
Sender: eric_mcdonald

Thanks for the new prerelease, Bruce.

I saw that you had a comment in the defLoad code about how the output time
stamp should be tracking the most recently modified template, and I did
consider going down that route. But, I ended up talking myself out of it
for a couple of reasons:
(1) It does not account for files which are 'extract' sources. They may be
more recent than the template, and if the extraction sources are deps in
your make rule for the output file, then the rule will never be satisfied.
(2) I couldn't think of any really good reason why one second after the
most recently modified template was better than the current time - other
than that it is consistent with how the definitions mtime is handled. The
typical behavior I expect from other programs is that the file modification
time is the time when the file was modified. ;-)

So, I don't have any strong objection to what you did in tpLoad.c, but I
think extraction sources might now need to be brought into consideration.

Just my two cents....


Date: 2009-10-10 14:34
Sender: bkorbProject AdminAccepting Donations

I think, though, the correct patch is to ensure that the output
time stamp is always at least as recent as any template that's
been opened. There must always be at least one...
Please look here for the 10pre8 (or later) version:
http://autogen.sourceforge.net/data/


Date: 2009-10-09 14:30
Sender: bkorbProject AdminAccepting Donations

Oops. I've rarely used it and I suspect not too many others do, either.
Thank you! 5.9.10 will be out shortly.


Attached File ( 1 )

Filename Description Download
no-defs-outtime.patch Fix for Output File Mtime in --no-definitions Mode Download

Changes ( 9 )

Field Old Value Date By
status_id Open 2009-10-10 20:44 eric_mcdonald
close_date - 2009-10-10 20:44 eric_mcdonald
allow_comments 1 2009-10-10 20:44 eric_mcdonald
status_id Pending 2009-10-10 15:48 eric_mcdonald
close_date 2009-10-09 14:30 2009-10-10 15:48 eric_mcdonald
status_id Open 2009-10-09 14:30 bkorb
close_date - 2009-10-09 14:30 bkorb
resolution_id None 2009-10-09 14:30 bkorb
File Added 345845: no-defs-outtime.patch 2009-10-09 00:44 eric_mcdonald