Issue 34746 - dmake doesn't set internal timestamp of phony targets to now
Summary: dmake doesn't set internal timestamp of phony targets to now
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: dmake (show other issues)
Version: 680m54
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hjs
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-28 16:38 UTC by hjs
Modified: 2013-08-07 15:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
see target "ooo" in sample makefile (190 bytes, text/txt)
2004-09-28 16:41 UTC, hjs
no flags Details
Patch for dmake (1.45 KB, patch)
2004-10-07 23:14 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description hjs 2004-09-28 16:38:09 UTC
if a target marked as .PHONY has own prerequisites, on building the internal
timestamp of this target is set to the timestamp of its prerequisite instead of now.
this prevents rebuild of any depending target.
Comment 1 hjs 2004-09-28 16:41:23 UTC
Created attachment 17982 [details]
see target "ooo" in sample makefile
Comment 2 quetschke 2004-09-28 21:37:56 UTC
Works as designed. You read the comment before you chased
me through the source, did you? ;)

It's coded exactly as your example suggests, but there must be a thinko
somewhere. The following patch fixes your example.
IMHO this is the correct fix, .PHONY doesn't require that a file has been
created/updated, therefore always assume the current time.
(Note that this can give funny effects on FAT32.)

(Alternatively one could touch the file if there is one and use that time.)

+++ dmake/sysintf.c     28 Sep 2004 20:24:04 -0000
@@ -710,12 +710,12 @@
 
    /* Compute phony time as either the current time, or the most recent time
     * from the list of prerequisites if there are any. */
-   if ( cp->ce_prq != NIL(LINK) ) {
+   /*   if ( cp->ce_prq != NIL(LINK) ) {
       for(dp=cp->ce_prq; dp; dp=dp->cl_next)
         if ( dp->cl_prq->ce_time > phonytime )
            phonytime = dp->cl_prq->ce_time;
    }
-   else
+   else */
       phonytime = Do_time();
 
    for(dp=CeMeToo(cp); dp; dp=dp->cl_next) {
Comment 3 hjs 2004-09-29 13:09:04 UTC
>Works as designed. You read the comment before you chased
>me through the source, did you? ;)

sorry, no i didn't. i couldn't imagine that this behaviour is intended. any idea
what might be the pupose of this? in real life it just causes the dependency
chain to break...
Comment 4 quetschke 2004-09-29 14:27:37 UTC
I think this is a bug and we should fix it. The docu says:
-- dmake man --
       .PHONY      Any target with this attribute set  will  have  its  recipe
                   executed each time the target is made even if a file match-
                   ing the target name can be located.  Any targets that  have
                   a  .PHONY  attributed target as a prerequisite will be made
                   each time the .PHONY attributed prerequisite is made.
-- dmake man --
So IMHO a phony target should be handled like a normal target with the
following two exceptions:
1. Allways build the target
2. Ignore the timestamp even if a file exists and assume it was just
   created/updated/touched.

No special rules for prerequisite timestamps.

I'm going to create a dmake43 cws and this might be a candidate for that
cws.
Comment 5 quetschke 2004-10-07 23:14:27 UTC
Created attachment 18215 [details]
Patch for dmake
Comment 6 quetschke 2004-10-07 23:19:43 UTC
I committed the previous patch.
Comment 7 quetschke 2004-10-07 23:20:23 UTC
Please verify.
Comment 8 hjs 2004-10-08 10:36:27 UTC
works as preferred :-)
Comment 9 hjs 2004-12-07 13:07:24 UTC
.