bugmake - Bugs: bug #63537, Regression in switches that can be...

 
 

bug #63537: Regression in switches that can be flipped back and forth.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Fri 16 Dec 2022 07:24:09 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.4.1 Operating System:  Any
Fixed Release:  4.4.1 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 20 Dec 2022 07:30:45 AM UTC, comment #2: 

Pushed these changes; thanks Dmitry!

Paul D. Smith <psmith>
Group administrator
Fri 16 Dec 2022 08:25:52 PM UTC, comment #1: 

This bug report is about switches that can be flipped back and forth.
Specifically, -S/-k, -w/--no-print-directory and -s/--no-silent.


1.
Makefile sets a flag in makeflags and this wipes out the opposite switch specified on the command line.


$ cat makefile
MAKEFLAGS:=-w
all:
$ make-4.4
make-4.4: Nothing to be done for 'all'.
$ make-4.3
make-4.3: Entering directory '/home/dgoncharov/src/gmake/test/makeflags7'
make-4.3: Nothing to be done for 'all'.
make-4.3: Leaving directory '/home/dgoncharov/src/gmake/test/makeflags7'
$


This is a regression compared to 4.3

This was broken in commit 8e024a253273a1e98b005d71c8ae4f6d2651fed4
Date:   Mon Mar 30 14:07:10 2020 -0400

    Obey order of multiple print/no-print directory options

Similary, other use cases fail.
--no-print-directory in makefile has effect even though -w is specified on the command line.
--no-silent set in makefile has effect even though -s is specified on the command line.
-s set in makefile has effect even though --no-silent is specified on the command line.
-k set in makefile is in effect, even though -S is specified on the command line.
-S set in makefile is in effect, even though -k is specified on the command line.


sv63537_fix_dash_w_in_makeflags_part1.diff fixes this regression for -w/--no-print-directory.
However, sv63537_fix_dash_w_in_makeflags_part1.diff also cancels the ability to obey order of -w/--no-print-directory options, that was introduced in 8e024a253273a1e98b005d71c8ae4f6d2651fed4.

sv63537_honor_origin_of_switches_part2.diff fixes this ability to obey order for all these flippable switches.

There is another regression compared to 4.3.



$ cat makefile12
$(info 1 at parse time makeflags = $(MAKEFLAGS))
MAKEFLAGS:=-w
$(info 2 at parse time makeflags = $(MAKEFLAGS))
all:; $(info at build time makeflags = $(MAKEFLAGS))
$ make-4.4 -f makefile12 --no-print-directory
1 at parse time makeflags =  --no-print-directory
2 at parse time makeflags = w
at build time makeflags = w
make: 'all' is up to date.


We can see that MAKEFLAGS has an incorrect value, which causes submake to receive incorrect switches.

2.
Aside from this, make fails to pass to submake those switches which are enabled by default, such as -S and --no-silent.



dgoncharov@madrid:~/src/gmake/test/makeflags7 $ cat makefile19
all:; $(MAKE) -C lib3
dgoncharov@madrid:~/src/gmake/test/makeflags7 $ cat lib3/makefile
MAKEFLAGS:=-k
all: one two
one:; false
two:; $(info $@)
dgoncharov@madrid:~/src/gmake/test/makeflags7 $ make-4.4 -f makefile19 -S
make-4.4 -C lib3
make-4.4[1]: Entering directory
'/home/dgoncharov/src/gmake/test/makeflags7/lib3'
false
make-4.4[1]: *** [makefile:3: one] Error 1
two
make-4.4[1]: Target 'all' not remade because of errors.
make-4.4[1]: Leaving directory
'/home/dgoncharov/src/gmake/test/makeflags7/lib3'
make-4.4: *** [makefile19:1: all] Error 2


We can see here that submake has -k in effect, even though -S is specified on the command line.

Patch sv63537_pass_switches_enabled_by_default_part3.diff takes care of passing enabled by default switches to submake.

To apply cleanly, the patches are supposed to be applied in order, part1, then part2, then part3.

All three patches together provide the following behavior of the flippable switches.

1. A switch can be enabled or disabled in makefile.
2. A switch can be enabled or disabled in env.
3. A switch can be enabled or disabled on the command line.
4. Command line beats makefile.
5. Env beats makefile.
6. Command line beats env.
7. MAKEFLAGS contains each specified switch at parse and build time.
8. If contradicting switches are specified in multiple origins, MAKEFLAGS contains the winning switch at parse and build time.
9. MAKEFLAGS does not contain the beaten switch.


Dmitry Goncharov <dgoncharov>
Fri 16 Dec 2022 07:24:09 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:
   

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-20 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Operating SystemNone Any
        Fixed ReleaseNone 4.4.1
    2022-12-16 dgoncharov Attached File- Added sv63537_doc.diff, #54112
    2022-12-16 dgoncharov Attached File- Added sv63537_fix_dash_w_in_makeflags_part1.diff, #54108
        Attached File- Added sv63537_pass_switches_enabled_by_default_part3.diff, #54109
        Attached File- Added sv63537_honor_origin_of_switches_part2.diff, #54110
        Attached File- Added sv63537_test.diff, #54111

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code