bugmake - Bugs: bug #60188, Explicit file built by an implicit...

 
 

bug #60188: Explicit file built by an implicit rule is not intermediate.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sun 07 Mar 2021 07:02:23 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.3 Operating System:  Any
Fixed Release:  4.4 Triage Status:  Medium Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 21 Mar 2021 03:09:25 PM UTC, comment #6: 

For #1, I tend write my own completely different pattern rules with unused suffixes like ".x" or ".z" or whatever, rather than try to re-use built-in pattern rules.

Thanks I'll look at the test.

Paul D. Smith <psmith>
Group administrator
Sun 21 Mar 2021 02:17:45 AM UTC, comment #5: 

Paul, i attached one more test
 sv60188_explicit_intermediate_test.diff.

This one tests that an explicitly mentioned file is still intermediate when it is a prereq to .INTERMEDIATE.

Dmitry Goncharov <dgoncharov>
Sun 21 Mar 2021 02:15:19 AM UTC, comment #4: 

Thank you, Paul.
1. Do you mean something like
CC="@echo cc"
?

2. sure

3. By the old style do you mean run_make_with_options?

Dmitry Goncharov <dgoncharov>
Mon 15 Mar 2021 06:23:34 AM UTC, comment #3: 

Thanks for those changes Dmitry.  I applied them mostly as-is.

Especially thanks for the tests!  For the future a few notes about tests:

1) Unless you're trying to test the built-in rules, it's best to not use any of them in the tests and instead define your own.  The problem is that the output of the built-in rules might be different on different platforms (for example the default compiler might be named something different) then the tests will fail.

2) I prefer to avoid adding TAB characters into my test rules unless they are really required, and instead use the ";" separator to put the entire rule one one line.  Otherwise, it's easy for editors which convert TAB to space in Perl code (which is common) to corrupt the test files when they're edited.

3) The tests available represent a significant evolution over time so the older tests and older test methods should be avoided; someday all the tests should be rewritten to use the modern syntax but in any event we should avoid adding more old-style tests even to test files that haven't been updated yet (the tests you provided here are all new-style so that's good, just FYI).

Cheers!

Paul D. Smith <psmith>
Group administrator
Mon 08 Mar 2021 03:22:05 PM UTC, comment #2: 

I agree this is a bug.  Thanks Dmitry I'll look at these fixes.

Now that your paperwork is (finally) complete I owe you a lot of patch reviews / applications.

Paul D. Smith <psmith>
Group administrator
Sun 07 Mar 2021 07:25:50 PM UTC, comment #1: 

sv60188_explicit_file_built_by_implicit_rule_is_not_intermediate.diff contains a fix.


All other attached patches contain new tests.
Even though the fix is not related to static pattern rules, i added a test for static pattern rules to cover all such situations.

Dmitry Goncharov <dgoncharov>
Sun 07 Mar 2021 07:02:23 PM UTC, original submission:  

Make incorrectly considers an explicit file built by an implicit rule as intermediate.

$ cat makefile
%.z: test.x
        touch $@

%.x: ;
$ touch hello.z
$ rm test.x
rm: cannot remove 'test.x': No such file or directory
$ make hello.z
make: 'hello.z' is up to date.

This is the relevant part of make -d output

Considering target file 'hello.z'.
 Looking for an implicit rule for 'hello.z'.
 Trying pattern rule with stem 'hello'.
 Trying rule prerequisite 'test.x'.
 Trying pattern rule with stem 'hello'.
 Trying rule prerequisite 'test.x'.
 Looking for a rule with intermediate file 'test.x'.
  Avoiding implicit rule recursion.
  Trying pattern rule with stem 'test'.
 Found an implicit rule for 'hello.z'.
 Finished prerequisites of target file 'hello.z'.
 Prerequisite 'test.x' of target 'hello.z' does not exist.
No need to remake target 'hello.z'.


make considers test.x an intermediate and does not build hello.z.
test.x should not be considered intermediate, because test.x is explicitly mentioned.

Dmitry Goncharov <dgoncharov>

 

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

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by dgoncharov (Submitted the item)
  •  

    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 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-21 dgoncharov Attached File- Added sv60188_explicit_intermediate_test.diff, #51095
    2021-03-15 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Component Version4.4 4.3
        Operating SystemNone Any
        Fixed ReleaseNone 4.4
        Triage StatusNone Medium Effort
    2021-03-07 dgoncharov Attached File- Added sv60188_statipattrules_test.diff, #51025
    2021-03-07 dgoncharov Attached File- Added sv60188_double_colon_test.diff, #51024
    2021-03-07 dgoncharov Attached File- Added sv60188_se_implicit_test.diff, #51023
    2021-03-07 dgoncharov Attached File- Added sv60188_grouped_targets_test.diff, #51022
    2021-03-07 dgoncharov Attached File- Added sv60188_patternrules_test.diff, #51021
    2021-03-07 dgoncharov Attached File- Added sv60188_explicit_file_built_by_implicit_rule_is_not_intermediate.diff, #51020

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code