bugmake - Bugs: bug #55532, Missing prerequisites are not...

 
 

bug #55532: Missing prerequisites are not included in $? if .SECONDARY is present

Submitter:  None
Submitted:  Mon 21 Jan 2019 01:03:46 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  None Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 26 Nov 2022 01:16:12 PM UTC, comment #6: 

Thanks, I agree with you.

BTW, my main motivation was to suppress the auto-removal of intermediate files in the chained implicit rules.

Make 4.4 introduced .NOTINTERMEDIATE. This is a better fit to my purpose because it has no side-effect to $?.

Masahiro Yamada <masahiroy>
Sun 25 Sep 2022 09:56:18 PM UTC, comment #5: 

I've changed my mind: I don't think this is a bug.

The docs for .SECONDARY say:

> [.SECONDARY targets] are treated as intermediate files

which means they are not rebuilt when they are missing.

The docs for $? say it contains:

> The names of all the prerequisites that are newer than the target

In other words, the prerequisites that caused the target to be rebuilt.  If you don't rebuild the prerequisite, then it's not in $?.  If it's intermediate, and it has no recipe, then it doesn't cause the target to be rebuilt (in your example, for instance, if you touch foo so that it's newer than baz, then the recipe will not be run even though bar is missing).

Paul D. Smith <psmith>
Group administrator
Tue 14 May 2019 03:43:04 AM UTC, comment #4: 


> It's extremely difficult to understand your bug report
> because you keep talking about $^ but after a lot of
> confused reading of your report and a close look at your
> example it's obvious you really mean $? everywhere you write $^.


Sorry about that.

I mean $? instead of $^.

I should have re-read my report before the submission.
I will be careful next time.

Masahiro Yamada <masahiroy>
Mon 13 May 2019 08:06:45 PM UTC, comment #3: 

The issue here is that although make runs a recipe to build the target, the target is not actually built.  If you change the bar target to something that creates the target:


bar: ; touch $@


then you'll get the output you expect even with SECONDARY:


touch bar
newer prerequisites are: bar baz


I think you are correct this is a bug, though.

Paul D. Smith <psmith>
Group administrator
Mon 13 May 2019 01:05:22 PM UTC, comment #2: 

It's extremely difficult to understand your bug report because you keep talking about $^ but after a lot of confused reading of your report and a close look at your example it's obvious you really mean $? everywhere you write $^.

Paul D. Smith <psmith>
Group administrator
Mon 21 Jan 2019 03:35:17 AM UTC, comment #1: 

Maybe, is it better to check other special targets as well?

'.PRECIOUS: bar' does not interfere the $^,
but I see similar weirdness for '.INTERMEDIATE: bar'.

Anonymous
Mon 21 Jan 2019 01:03:46 AM UTC, original submission:  

The $^ should contain all the prerequisites that are newer than the target, including missing prerequisites.

However, the '.SECONDARY' special target is present,
the missing prerequisites are not included in the ^$.


[Test code]

foo: bar baz
        @echo newer prerequisites are: $?

bar:

.SECONDARY:


[Result]

$ touch foo
$ touch baz
$ make
newer prerequisites are: baz


The 'baz' is correctly contained in $^ since it is newer than 'foo'.

We expect 'bar' in $^ as well because it does not exist. However, this behavior is changed by the presence of .SECONDARY.

If you delete the '.SECONDARY:' line, the result is what we expect:

$ make
newer prerequisites are: bar baz

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by masahiroy (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-25 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed
    2019-05-13 psmith StatusNot A Bug None
        Open/ClosedClosed Open
    2019-05-13 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed
    2019-05-13 psmith SummaryMissing prerequisites are not included in $^ if .SECONDARY is present Missing prerequisites are not included in $? if .SECONDARY is present

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code