job000012

david_abrahams (David Abrahams)
David Abrahams created this job , modified by Shawn Hladky
Closed
TEMPORARY is broken in stock Jam

From: http://maillist.perforce.com/pipermail/jamming/2002-January/001530.html :

| BTW, TEMPORARY is broken in stock Jam - it doesn't work right if the target
| has multiple parents. My patch is:
|

make.c:

| ***************
| *** 175,180 ****
| --- 201,217 ----
|        printf( "warning: %s depends on itself\n", t->name );
|        return;
|
| +         /* Deal with TEMPORARY targets with multiple parents. When a
| missing
| +          * TEMPORARY target is determined to be stable, it inherits the
| +          * timestamp of the parent being checked, and is given a binding
| of
| +          * T_BIND_PARENTS. To avoid outdating parents with earlier
| modification
| +          * times, we set the target's time to the minimum time of all
| parents.
| +          */
| +         case T_FATE_STABLE:
| +             if ( t->binding == T_BIND_PARENTS && t->time > ptime &&
| t->flags & T_FLAG_TEMP )
| +                 t->time = ptime;
| +             return;
| +
|    default:
|        return;
1545Handle TEMPORARY targets with multiple parents better (but not
perfectly).

Previously, a TEMPORARY target that had no timestamp of its own
(t->time == 0, due to the target being missing) took on its
parent's timestamp ptime.  The target's timestamp is used for
four things:

1. It is passed as the target's timestamp to its children,
   in case they are also TEMPORARY targets (and thus need their
   parent's timestamp).

2. It is compared against the target's children's timestamps,
   to see if the target is out of date.

3. It is compared against the target's parent time, to see if
   the target is newer than its parent (for 'actions updated').

4. It is saved as the target's timestamp, for when the target's
   parents need to see if they are out of date.

The problem was with (4) and multiple parents: the first parent's
timestamp would become the target's, which could then inadvertantly
outdate another parent older than the first but otherwise
up-to-date.

With this change a missing TEMPORARY target is left with a zero
timestamp, and the four above cases are modified for T_BIND_PARENT
targets as such:

1. The parent's timestamp is passed directly to the target's
   children.

2. The parent's timestamp is compared directly against the
   target's children's timestamps.

3. The parent's timestamp is no longer compared against the
   target's own, as it could never be older.

4. The target's timestamp remains zero (or the newest of the
   target's children's), so as not to outdate other parents.

Oddly enough, this change mostly just removes the setting of
't->time = ptime' (leaving t->time zero), and adds only a little
extra logic to use ptime directly when needed.  It also removes
the 'pbinding' parameter to make0(), as its only use (to indicate
if the parent was missing) can better be divined from !ptime.
Perfection, as they say, isn't achieved when there is nothing
more to add, but nothing more to take away.  We'll see if I
removed enough this time.

Bug fix documented in RELNOTES.
  • Details
  • Comments -
Status
Closed
Project
jam
Severity
B
Reported By
David Abrahams
Reported Date
Modified By
Shawn Hladky
Modified Date