bugmake - Bugs: bug #64259, Regression in master: make ignores...

 
 

bug #64259: Regression in master: make ignores statements it should not ignore.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sat 27 May 2023 03:33:14 PM UTC
Votes: 1
 
Severity:  3 - Normal Priority:  5 - Normal
Item Group:  Bug Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Component Version:  SCM
Operating System:  Any Fixed Release:  None
Triage Status:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Wed 27 Aug 2025 03:39:12 AM UTC, comment #4: 

Dmitry, I reverted the original change for bug #64185.  I think I ensured that ALL instances of directives which are indented with TAB (and are not in a recipe context) get a warning.

In a future version of GNU make we can consider making this an error in which case no directive indented with a TAB can ever be considered a directive.

But for now I'm going to close this as a duplicate unless you think I missed something.

Thanks!

Paul D. Smith <psmith>
Group administrator
Mon 18 Dec 2023 10:03:24 AM UTC, comment #3: 

Paul did pretty much explicitly say in the introducer, bug #64185, that he wasn't interested in being told about:

> people indenting their conditionals with the recipe prefix


... and yet here I am, sorry, pointing at the tab still at https://git.kerne ... e?h=v6.7-rc6#n902 since 2010-10-13 17:12:30 -0400 -email is unavailable- (72441cb1fd77d092f09ddfac748955703884c9a7). There are others but that's the one that's just cost me a few hours to hack out on our driver build installation for 11 kernels of varying ages. I know the Linux build system's compatibility with Gnu Make has been important to a number of other posters over the years. I wonder that we haven't heard from Yamada-san, who we did hear from in bug #64288 after the introducer went in.

Martin Dorey <mdorey>
Sun 17 Dec 2023 10:53:49 PM UTC, comment #2: 

The change suggested here doesn't treat these two cases quite symmetrically:

martind@stormy:~/tmp/make-missing-endif$ printf 'ifeq "a" "a"\n\tendif\ndefault:;\n' > Makefile; ~/download/make/make
Makefile:2: *** recipe commences before first target.  Stop.
martind@stormy:~/tmp/make-missing-endif$ printf 'ifeq "a" "b"\n\tendif\ndefault:;\n' > Makefile; ~/download/make/make
Makefile:4: *** missing 'endif'.  Stop.
martind@stormy:~/tmp/make-missing-endif$

I'd say that's only a minor code smell.  I consider it an advance on the pushed code, which accepts the first, while rejecting the second.  It better fulfills the NEWS entry by rejecting:

martind@stormy:~/tmp/make-missing-endif$ printf '\tifeq "" ""\nendif\ndefault:;\n' > Makefile; ~/download/make/make
Makefile:1: *** recipe commences before first target.  Stop.
martind@stormy:~/tmp/make-missing-endif$

... which the pushed code accepts:

martind@stormy:~/tmp/make-missing-endif$ printf '\tifeq "" ""\nendif\ndefault:;\n' > Makefile; ~/bin/make-4.4.90
make-4.4.90: 'default' is up to date.
martind@stormy:~/tmp/make-missing-endif$


I'd like to also suggest this correction to the introducer:

martind@stormy:~/download/make$ git diff tests/scripts/features/conditionals
diff --git a/tests/scripts/features/conditionals b/tests/scripts/features/conditionals
index c1eee95c..27417623 100644
--- a/tests/scripts/features/conditionals
+++ b/tests/scripts/features/conditionals
@@ -153,7 +153,7 @@ endif
 ',
               '', "one\n");

-# SV 64085: Ensure recipe prefixed conditionals are never considered
+# SV 64185: Ensure recipe prefixed conditionals are never considered
 run_make_test(q!
 blah=1
 ifdef blah
martind@stormy:~/download/make$

I struggled to find the right bug, hence to find my way here.

Martin Dorey <mdorey>
Sat 27 May 2023 03:44:30 PM UTC, comment #1: 

Commit 07fcee35f058a876447c8a021f9eb1943f902534 introduced a regression.

The text in NEWS clarifies that the idea was to never consider a line starting with the recipe prefix as a conditional, to ensure make does not confuse recipe lines with conditionals as described in sv 64185.

However, there are cases where the fix
1. Still considers lines starting with the recipe prefix as conditionals.
2. Ignores lines which it should not ignore.

In this makefile both 'ifdef blah' and 'else' are intended with tabs.


$ ls
makefile
$ cat makefile
        ifdef blah
$(info true)
        else
$(info false)
endif
all:
$ make-4.4
false
make-4.4: Nothing to be done for 'all'.
$ # this is the latest make from master
$ ~/src/gmake/make/m64/make
make: Nothing to be done for 'all'.


We can see the latest make
1. honored 'ifdef blah', even though it is intended with a tab.
2. failed to run '$(info false)'.

The patch in the attachment causes make to fail with a syntax error here.
The patch keeps NEWS intact.

Dmitry Goncharov <dgoncharov>
Sat 27 May 2023 03:33:14 PM UTC, original submission:  

.

Dmitry Goncharov <dgoncharov>

 

Attached Files

Attached Files
file #54791:  sv64259_fix.diff added by dgoncharov (2.4KiB - text/x-patch)
file #54792:  sv64259_test.diff added by dgoncharov (1.0KiB - text/x-patch)

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by mdorey (Voted in favor of this item)
  • -email is unavailable- added by mdorey (Posted a comment)
  • -email is unavailable- added by dgoncharov (Submitted the item)
  •  

    Votes

    There is 1 vote 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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-08-27 psmith StatusNone Duplicate
        Open/ClosedOpen Closed
        Operating SystemNone Any
    2023-12-17 mdorey Carbon-Copy- Added mdorey
    2023-05-27 dgoncharov Attached File- Added sv64259_fix.diff, #54791
        Attached File- Added sv64259_test.diff, #54792

    Back to the top

    Powered by Savane 3.16-598c.
    Corresponding source code