bugmake - Bugs: bug #63840, make allows match-anything rules...

 
 

bug #63840: make allows match-anything rules to match files with the default suffixes

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sun 26 Feb 2023 07:59:52 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.4 Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 27 Feb 2023 03:18:22 AM UTC, comment #3: 


> If you use -r then you've removed all the implicit rules in the makefile, including suffix rules, and so I don't necessarily agree with the idea that even in this case we should still treat these suffixes as special when considering match-anything rules.   

                                                                                                                                 
My opinion is that, removal of the built-in rules is all about relieving make from doing extra work.  This helps performance, troubleshooting and reduces -d output. imo, the current behavior, when -r causes match-anything rules to be eligible does the opposite of -r should do, which is it increases the amount of work, rather then reduces it. i also think, presence or absence of built-in rules, including suffix rules, is orthogonal to whether match-anything rules are eligible for files with specific data.                                   
                                                                                                                                 
Looks like i did not convey it well enough in the original description. It is removal of the built-in rules that causes match-anything rules to be eligible. It is not clearing of the default suffixes that causes this behavior. If you clear the list of the default suffixes, match-anything rules are still not eligible for the files with the (now cleared) default suffixes.                 
                                                                                                                                 
Example 5                                                                                                                        
                                                                                                                                 

$ ls
hello.c.o  makefile
$ cat makefile
.SUFFIXES:
hello.c:
%: %.o; $(info $@ from $<)
$ make-4.4
make-4.4: Nothing to be done for 'hello.c'.


Dmitry Goncharov <dgoncharov>
Sun 26 Feb 2023 09:15:33 PM UTC, comment #2: 

I'm not sure I get the change suggested.  If you use -r then you've removed all the implicit rules in the makefile, including suffix rules, and so I don't necessarily agree with the idea that even in this case we should still treat these suffixes as special when considering match-anything rules.

There do seem to be some bizarre behaviors here which need to be understood but I'm not sure the right answer is as simple as, "never consider match-anything rules for targets with the default suffix list even if -r is provided".

But maybe I didn't fully understand the issue being reported.

Paul D. Smith <psmith>
Group administrator
Sun 26 Feb 2023 08:05:16 PM UTC, comment #1: 

When the built-in rules are disabled, make allows match-anything rules to match files with the default suffixes.

Example 1 demonstrates how a match-anything pattern rule incorrectly matches a file with the default suffix when the built-in rules are disabled.


$ ls
hello.c.o  makefile
$ cat makefile
hello.c:
%: %.o; $(info $@ from $<)
$ make-4.4
make-4.4: Nothing to be done for 'hello.c'.
$ make-4.4 -r
hello.c from hello.c.o
make-4.4: 'hello.c' is up to date.



Example 2 demonstrates how a match-anything pattern rule incorrectly matches a file with a user defined suffix when the built-in rules are disabled.


$ ls
hello.c.x  makefile
$ cat makefile
hello.c:
%: %.x; $(info $@ from $<)
$ make-4.4
make-4.4: Nothing to be done for 'hello.c'.
$ make-4.4 -r
hello.c from hello.c.x
make-4.4: 'hello.c' is up to date.



Example 3 demonstrates how a single suffix rule incorrectly matches a file with the default suffix when the built-in rules are disabled.


$ ls
hello.c.o  makefile
$ cat makefile
.SUFFIXES:
.SUFFIXES: .o
hello.c:
.o:; $(info $@ from $<)
$ make-4.4
make-4.4: Nothing to be done for 'hello.c'.
$ make-4.4 -r
hello.c from hello.c.o
make-4.4: 'hello.c' is up to date.


Example 4 demonstrates how a single suffix rule incorrectly matches a file with a user defined suffix when the built-in rules are disabled.


$ ls
hello.c.x  makefile
$ cat makefile
.SUFFIXES:
.SUFFIXES: .x
hello.c:
.x:; $(info $@ from $<)
$ make-4.4
make-4.4: Nothing to be done for 'hello.c'.
$ make-4.4 -r
hello.c from hello.c.x
make-4.4: 'hello.c' is up to date.



When built-in rules are enabled, the default suffixes are entered as files on startup and then converted to dummy pattern rules. These dummy pattern rules prevent match-anything rules from matching files with the default suffixes.
When built-in rules are disabled, the default suffixes are not entered as files and not converted to dummy pattern rules. Because the dummy rules are missing make fails to recognize files with the default suffixes.

This patch enters the default suffixes as files whether built-in rules are enabled or not.



Dmitry Goncharov <dgoncharov>
Sun 26 Feb 2023 07:59:52 PM UTC, original submission:  

.

Dmitry Goncharov <dgoncharov>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #54396:  sv63840_fix.diff added by dgoncharov (7KiB - text/x-patch)
file #54397:  sv63840_test.diff added by dgoncharov (10KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Updated the item)
  • -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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-26 psmith Component Version4.4.1 4.4
    2023-02-26 dgoncharov Attached File- Added sv63840_fix.diff, #54396
        Attached File- Added sv63840_test.diff, #54397

    Back to the top

    Powered by Savane 3.12