bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Dmitry Goncharov
Subject: [bug #63537] Regression in switches that can be flipped back and forth.
Date: Fri, 16 Dec 2022 15:25:53 -0500 (EST)

Follow-up Comment #1, bug #63537 (project make):

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.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63537>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]