Discussion:
[1003.1(2013)/Issue7+TC1 0000857]: Make rules which do not create the target file or do unexpected things with its timestamp
Austin Group Bug Tracker
2014-08-07 16:18:44 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-07 16:18 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================

----------------------------------------------------------------------
(0002335) eblake (manager) - 2014-08-07 16:18
http://austingroupbugs.net/view.php?id=857#c2335
----------------------------------------------------------------------
see http://austingroupbugs.net/view.php?id=523 for case 1

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
======================================================================
Austin Group Bug Tracker
2014-08-07 16:18:55 UTC
Permalink
The following issue has been set as RELATED TO issue 0000523.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-07 16:18 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
======================================================================
Austin Group Bug Tracker
2014-08-07 17:16:29 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-07 17:16 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
======================================================================

----------------------------------------------------------------------
(0002336) mdempsky (reporter) - 2014-08-07 17:16
http://austingroupbugs.net/view.php?id=857#c2336
----------------------------------------------------------------------
It strikes me that there are two key issues here:

1. The "make" section doesn't adequately define "out-of-date",
"up-to-date", or "bring a target up-to-date". It gives a [questionable]
definition for "out-of-date", and it's somewhat implied that "up-to-date"
means "not out-of-date", and what it means to "bring a target up-to-date"
is only explicitly described for the case where the target has no
commands.

2. The wording "After make has ensured that all of the prerequisites of a
target are up-to-date and if the target is out-of-date" implies the
"out-of-date" check is done *after* recursing on the prerequisites, whereas
I believe existing make implementations determine "out-of-date"ness before
running any commands.


Here's a quick test to try:

$ cat Makefile
.POSIX:
one: two
echo one
two:
echo two

$ touch one

$ make one

Strictly following POSIX's definition of "out-of-date", target "two" here
is "out-of-date" because it does not exist, but target "one" *does* exist
and its not older than any of its prerequisites. It stands to reason that
a POSIX-compliant make utility should only run "echo two".

However, at least GNU make and NetBSD make (tested on Ubuntu 14.04) run
both the "echo two" command and then also "echo one". I'd be interested in
knowing if any other make implementations behave differently.


I'd suggest addressing this issue along the following lines:

1. Define that "out-of-date" means the target does not exist, its file
modification time is older than any of its prerequisites, or any of its
prerequisites are "out-of-date". The determination of whether targets are
"out-of-date" is made before "make" executes any commands.

2. Define that to "bring a target up-to-date" for an "out-of-date" target
means to bring each of its prerequisites up-to-date (in order) and then to
execute the target's commands (if any). If a target is not "out-of-date",
then nothing needs to be done to bring it up-to-date.

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
2014-08-07 17:16 mdempsky Note Added: 0002336
======================================================================
Antoine Leca
2014-08-08 10:18:47 UTC
Permalink
[ This is posted to the mailing list as instructed by Andrew,
but I can add it as a note if it is seen as more appropriate. ]

Hi,

I observe some variance in the way the objective of make(1) was defined.

In V7 manual, or in 4.3BSD "old" make, one may read:
/Make/ updates a target if it depends on prerequisite files that have
been modified since the target was last modified, or if the target
does not exist.
This suggests to me the behaviour where the target is updated as soon as
any of its prerequisite was previously updated by the same invocation of
the utility, since the utility can deduce the prerequisite file had been
modified (by itself)

On the other hand, SVID, or System III manual, reads as:
/make/ updates a target only if its dependents are newer than the
target. All prerequisite files of a target are added recursively to
the list of targets. Missing files are deemed to be outdated.
This may suggest an additional time-stamp test, even in the case the
prerequisite was just updated by the same invocation of the utility.

However, it is not clear to me whether the historic utilities actually
implemented the change suggested by the semantic variation...


While substantially reworded, POSIX text is clearly a descendant of the
SVID semantic, with out-of-date defined in term of older. However, an
important addition is the requirement that "the make utility shall use
the modification times of files to determine whether the corresponding
targets are out-of-date," which suggests to prevent any deduction about
the new-ness of a just-updated prerequisite file.
Perhaps the intended point of this later text was in fact only to
specify which timestamp to consider (the original POSIX.2:93 document
had a reference to "File Times Values" attached, which was not kept.)

Also, the text does not adequately cover the case of a "corresponding"
prerequisite file which does not exist to determine "out-of-date"-ness,
which is the case raised by Matthew: *two* does not exist after the
*echo two* command, so how to know whether *one* is out-of-date or not?


Antoine
Joerg Schilling
2014-08-08 10:26:45 UTC
Permalink
Post by Antoine Leca
/make/ updates a target only if its dependents are newer than the
target. All prerequisite files of a target are added recursively to
the list of targets. Missing files are deemed to be outdated.
This may suggest an additional time-stamp test, even in the case the
prerequisite was just updated by the same invocation of the utility.
No, there is no intention to test the timestamps of targets that "have been
made" in case that the command that was run had a zero exit code. In case that
there is no command defined for the target, success is assumed as well.

In such "sucess cases", make just assumes that the target was successfully
remade and internally remembers a special date value that indicates "younger
than any dependent file".

As a result, any other target that depends on such a target is remade.

Jörg
--
EMail:joerg-lSlhzV3CM+2sTnJN9+***@public.gmane.org (home) Jörg Schilling D-13353 Berlin
joerg.schilling-8LS2qeF34IpklNlQbfROjRvVK+***@public.gmane.org (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/'
Austin Group Bug Tracker
2014-08-07 17:17:49 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-07 17:17 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
======================================================================

----------------------------------------------------------------------
(0002337) mdempsky (reporter) - 2014-08-07 17:17
http://austingroupbugs.net/view.php?id=857#c2337
----------------------------------------------------------------------
Mantis mangled my example Makefile, so here it is again (hopefully mangling
free):

.POSIX:
one: two
echo one
two:
echo two

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
2014-08-07 17:16 mdempsky Note Added: 0002336
2014-08-07 17:17 mdempsky Note Added: 0002337
======================================================================
Austin Group Bug Tracker
2014-08-08 10:41:11 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-08 10:41 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
======================================================================

----------------------------------------------------------------------
(0002338) antoinel (reporter) - 2014-08-08 10:41
http://austingroupbugs.net/view.php?id=857#c2338
----------------------------------------------------------------------
see http://austingroupbugs.net/view.php?id=763 for case 4, first part

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
2014-08-07 17:16 mdempsky Note Added: 0002336
2014-08-07 17:17 mdempsky Note Added: 0002337
2014-08-08 10:41 antoinel Note Added: 0002338
======================================================================
Austin Group Bug Tracker
2014-08-08 11:44:51 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-08 11:44 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
======================================================================

----------------------------------------------------------------------
(0002340) jammule (reporter) - 2014-08-08 11:44
http://austingroupbugs.net/view.php?id=857#c2340
----------------------------------------------------------------------
<p>Regarding mdempsky's comment in
(http://austingroupbugs.net/view.php?id=857#c2336)</p>
<blockquote>I believe existing make implementations determine
"out-of-date"ness before running any commands.</blockquote>
<p>This would be incorrect. Try running "make one" twice with this
makefile:</p>
<pre>
one: two
touch one
two: three
[ -e two ] || touch two
three: FORCE
touch three
FORCE:
</pre>
<p>If make would check the out-of-dateness before running any commands, all
targets should be created every time. This does not happen with at least
NetBSD or GNU make. On the second run "one" is not touched, because "two"
is not actually updated even if it was out-of-date compared to "three".
This is in my opinion what is expected and is reasonable and also at least
one of the reasons why the "-t" command line switch exists.</p>
<p>Consider a case where a single file is used to generate multiple other
files, which in turn are dependencies for other files. For example, some
automatic code generation tool creates multiple header files for different
modules. Just because the input for the code generator has changed does
not mean that all or even any of the generated files have changed
semantically.</p>
<p>Running the commands to generate the headers cannot be avoided because
their dependencies are newer, but those rules may well utilize temporary
files to check if the generated file has actually changed and only update
the target when that happens. This will prevent make (at least GNU and
NetBSD) from unnecessarily updating any of the targets, which might be
numerous, that depend on the header.</p>
<p>Thus, I do not think it would be wise to add this requirement to the
standard:</p>
<blockquote>The determination of whether targets are "out-of-date" is made
before "make" executes any commands.</blockquote>

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
2014-08-07 17:16 mdempsky Note Added: 0002336
2014-08-07 17:17 mdempsky Note Added: 0002337
2014-08-08 10:41 antoinel Note Added: 0002338
2014-08-08 10:42 antoinel Note Edited: 0002338
2014-08-08 10:42 antoinel Note Edited: 0002338
2014-08-08 10:43 antoinel Note Edited: 0002338
2014-08-08 10:44 antoinel Note Edited: 0002338
2014-08-08 10:47 antoinel Note Edited: 0002338
2014-08-08 10:47 antoinel Note Edited: 0002338
2014-08-08 10:51 antoinel Note Edited: 0002338
2014-08-08 11:44 jammule Note Added: 0002340
======================================================================
Austin Group Bug Tracker
2014-08-08 12:22:05 UTC
Permalink
The following issue has been set as RELATED TO issue 0000763.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-08 12:22 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
related to 0000763 If rule has no prerequisites or command...
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
2014-08-07 17:16 mdempsky Note Added: 0002336
2014-08-07 17:17 mdempsky Note Added: 0002337
2014-08-08 10:41 antoinel Note Added: 0002338
2014-08-08 10:42 antoinel Note Edited: 0002338
2014-08-08 10:42 antoinel Note Edited: 0002338
2014-08-08 10:43 antoinel Note Edited: 0002338
2014-08-08 10:44 antoinel Note Edited: 0002338
2014-08-08 10:47 antoinel Note Edited: 0002338
2014-08-08 10:47 antoinel Note Edited: 0002338
2014-08-08 10:51 antoinel Note Edited: 0002338
2014-08-08 11:44 jammule Note Added: 0002340
2014-08-08 11:47 jammule Note Edited: 0002340
2014-08-08 12:22 eblake Relationship added related to 0000763
======================================================================
Austin Group Bug Tracker
2014-08-08 17:10:33 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=857
======================================================================
Reported By: jammule
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 857
Category: Shell and Utilities
Type: Omission
Severity: Comment
Priority: normal
Status: New
Name: Jarmo Jaakkola
Organization:
User Reference:
Section: make
Page Number: 2937
Line Number: 97105-97113
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-07-08 10:14 UTC
Last Modified: 2014-08-08 17:10 UTC
======================================================================
Summary: Make rules which do not create the target file or do
unexpected things with its timestamp
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0000523 Add support for special target .PHONY i...
related to 0000763 If rule has no prerequisites or command...
======================================================================

----------------------------------------------------------------------
(0002343) mdempsky (reporter) - 2014-08-08 17:10
http://austingroupbugs.net/view.php?id=857#c2343
----------------------------------------------------------------------
Ah, I stand corrected. Thanks for that demonstration test case!

Issue History
Date Modified Username Field Change
======================================================================
2014-07-08 10:14 jammule New Issue
2014-07-08 10:14 jammule Name => Jarmo Jaakkola
2014-07-08 10:14 jammule Section => make
2014-07-08 10:14 jammule Page Number => 2937
2014-07-08 10:14 jammule Line Number => 97105-97113
2014-07-08 10:24 jammule Issue Monitored: jammule
2014-07-08 10:25 jammule Issue End Monitor: jammule
2014-08-07 16:18 eblake Note Added: 0002335
2014-08-07 16:18 eblake Relationship added related to 0000523
2014-08-07 17:16 mdempsky Note Added: 0002336
2014-08-07 17:17 mdempsky Note Added: 0002337
2014-08-08 10:41 antoinel Note Added: 0002338
2014-08-08 10:42 antoinel Note Edited: 0002338
2014-08-08 10:42 antoinel Note Edited: 0002338
2014-08-08 10:43 antoinel Note Edited: 0002338
2014-08-08 10:44 antoinel Note Edited: 0002338
2014-08-08 10:47 antoinel Note Edited: 0002338
2014-08-08 10:47 antoinel Note Edited: 0002338
2014-08-08 10:51 antoinel Note Edited: 0002338
2014-08-08 11:44 jammule Note Added: 0002340
2014-08-08 11:47 jammule Note Edited: 0002340
2014-08-08 12:22 eblake Relationship added related to 0000763
2014-08-08 17:10 mdempsky Note Added: 0002343
======================================================================
Loading...