bugmake - Bugs: bug #61218, The -e option confuses the...

 
 

bug #61218: The -e option confuses the $(origin )

Submitter:  Masahiro Yamada <masahiroy>
Submitted:  Sat 25 Sep 2021 07:12:00 AM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.3 Operating System:  Any
Fixed Release:  4.4.1 Triage Status:  Small Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 08 Jan 2023 09:50:43 PM UTC, comment #1: 

This was a little odd.  The problem is that if -e is given, due to a weird set of coincidences, the MAKEFLAGS variable is not expanded before it's passed to jobs via the environment.  If -e is not given, then MAKEFLAGS is expanded.

This was difficult to see in practice since, although command line overrides were not not present in MAKEFLAGS as expected, they were in the environment and since -e was given those took precedence over the makefile settings.  But, it was possible to tell via the origin function as Masahiro discovered.

I've pushed a fix for this.

Paul D. Smith <psmith>
Group administrator
Sat 25 Sep 2021 07:12:00 AM UTC, original submission:  

Two makefiles are attached.


Without -e, $(origin FOO) remembers
that FOO came from the command line.




masahiro@grover:~$ make FOO=1
the origin of FOO: command line
FOO: 1
MAKEOVERRIDES: FOO=1
make -f Makefile.sub
make[1]: Entering directory '/home/masahiro'
the origin of FOO: command line
FOO: 1
MAKEOVERRIDES: FOO=1
make[1]: Leaving directory '/home/masahiro'



With -e, $(origin FOO) in the sub-make
shows 'environment' while it was given
from the command line.
Interestingly, FOO=1 was removed from ​$(MAKEOVERRIDES)



masahiro@grover:~$ make -e FOO=1
the origin of FOO: command line
FOO: 1
MAKEOVERRIDES: FOO=1
make -f Makefile.sub
make[1]: Entering directory '/home/masahiro'
the origin of FOO: environment
FOO: 1
MAKEOVERRIDES:
make[1]: Leaving directory '/home/masahiro'


Related discussion:
https://lists.gnu.org/archive/html/help-make/2021-09/msg00005.html
R

Masahiro Yamada <masahiroy>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51961:  Makefile added by masahiroy (132B - application/octet-stream)
file #51962:  Makefile.sub added by masahiroy (112B - text/x-microdvd)

 

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 masahiroy (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-08 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Component VersionNone 4.3
        Operating SystemNone Any
        Fixed ReleaseNone 4.4.1
        Triage StatusNone Small Effort
    2021-09-25 masahiroy Attached File- Added Makefile, #51961
        Attached File- Added Makefile.sub, #51962

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code