bugmake - Bugs: bug #64803, Fix origin of variables from env...


bug #64803: Fix origin of variables from env when -e is set.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sat 21 Oct 2023 09:19:42 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  SCM Operating System:  Any
Fixed Release:  SCM Triage Status:  Medium Effort
* Mandatory Fields

Add a New Comment Rich Markup

Sun 04 Feb 2024 11:35:33 PM UTC, comment #2: 

I applied these changes, with some differences in implementation, plus all the tests provided here except the changes to the MAKEFLAGS tests which are no longer needed.

Thanks Dmitry!

Paul D. Smith <psmith>
Group administrator
Sat 21 Oct 2023 09:35:17 PM UTC, comment #1: 

Variables inherited from env have incorrect origin 'environment' when -e is set
and the makefile does not modify the variable.

$ ls
$ cat makefile
$(info at parse time hello=$(hello), origin = $(origin hello))
all:; $(info at build time hello=$(hello), origin = $(origin hello))
$ # this is the latest make from master
$ hello=world ~/src/make/m64/make -e
at parse time hello=world, origin = environment
at build time hello=world, origin = environment
make: 'all' is up to date.
$ hello=world make-4.3 -e
at parse time hello=world, origin = environment
at build time hello=world, origin = environment
make-4.3: 'all' is up to date.

This happens because make goes through env variables and defines related make variables
before the command line switches are processed and make has not figured out yet that
-e is specified.
This patch reads command line switches and sets global variable 'env_overrides' before
going through env variables.

This fix is split into 2 patches. The patches are supposed to be applied in
order, part1 before part2. This split keeps logically independent
changes in separate commits. Hopefully, this will make review easier and allows
to refer to or revert individual commits.

Dmitry Goncharov <dgoncharov>
Sat 21 Oct 2023 09:19:42 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:

Attached Files
file #55263:  sv64803_fix_part1.diff added by dgoncharov (4KiB - text/x-patch)
file #55264:  sv64803_fix_part2.diff added by dgoncharov (15KiB - 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 (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-04 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone SCM
        Triage StatusNone Medium Effort
    2023-10-21 dgoncharov Attached File- Added sv64803_fix_part1.diff, #55263
        Attached File- Added sv64803_fix_part2.diff, #55264

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code