Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001423 [Issue 8 drafts] Shell and Utilities Objection Clarification Requested 2020-11-18 21:28 2020-11-19 14:40
Reporter joerg View Status public  
Assigned To
Priority normal Resolution Open  
Status New   Product Version Draft 1.1
Name Jörg Schilling
Organization
User Reference
Section make
Page Number 2888
Line Number 97001-97006
Final Accepted Text
Summary 0001423: The make commandline argument macro::=value has unspecified bahavior
Description It is common accepted behavior that

  make macro=value

overwrites definitions from makefiles. This can be implemented in
two ways

- evaluate the command line argument before reading makefiles
  and mark the related macro readonly

- evaluate the command line argument after reading makefiles

Both methods result in the same result (even though the assumption
that command line arguments overwrite makefiles should be specified
in the standard). Note that the current text allows a make implementation
to evaluate command line macro assignments before reading makefiles
witout making them readonly and if this would be done, the assignments
in the makefiles would overwrite the commandline arguments.

With the command

  make macro::=value

the two possible implementations mentioned above give different
results.

My gut feeling is that people would expect "make 'macro::=$(macro2)'"
expands $(macro2) as defined in the makefiles instead of expanding
it as empty macro value, but this needs to be specified in the standard.
Desired Action After line 97005 after the text "in the order they appear"

insert the text:

as if the command line macro definitions were evaluated after reading the makefiles
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0005115)
geoffclare (manager)
2020-11-19 09:38

The claim that the behaviour is unspecified is incorrect, and the suggested change would contradict existing text that specifies the behaviour here (not because it would require different behaviour, but because the existing text handles this a different way). See draft 1.1 page 2896 lines 97343-97361 noting in particular line 97344 "before the makefile(s) are read" and lines 97360-97361 "Macros defined in the makefile(s) shall not override macro definitions from source 1 or source 2."

Can we process this bug as withdrawn?
(0005116)
joerg (reporter)
2020-11-19 11:29
edited on: 2020-11-19 11:29

The problem with that text is that it makes macro::=value on the
command line a useless feature since at that time, there are no
macro definitions that could be expanded.

So it would be a wise idea to remove macro::= value from the beginning
of line 97002.

This definitely needs to be discussed.

(0005117)
geoffclare (manager)
2020-11-19 12:19

There can be macro definitions from earlier command line macro assignments. E.g.:
echo 'all: ; echo $(BAR)' | make -f - FOO=1 BAR::='$(FOO)' FOO=2
is required to output 1 whereas with BAR='$(FOO)' it would output 2.
(0005118)
joerg (reporter)
2020-11-19 13:39
edited on: 2020-11-20 11:58

Just because you are correct with this note, people would
intuitively expect

   make BAR::='$(FOO)'

to expand previous definitions from FOO in the makefiles.

I know this is harder to implement, but shouldn't we avoid
to standardize unexpected results?

(0005119)
geoffclare (manager)
2020-11-19 14:40

There is no such thing as "previous definitions from FOO in the makefiles". The standard clearly states that macro definitions are taken from the command line before the makefile(s) are read, as I pointed out in my first note.

Of course the usual "as if" rule applies here.

- Issue History
Date Modified Username Field Change
2020-11-18 21:28 joerg New Issue
2020-11-18 21:28 joerg Name => Jörg Schilling
2020-11-18 21:28 joerg Section => make
2020-11-18 21:28 joerg Page Number => 2888
2020-11-18 21:28 joerg Line Number => 97001-97006
2020-11-19 09:38 geoffclare Note Added: 0005115
2020-11-19 11:29 joerg Note Added: 0005116
2020-11-19 11:29 joerg Note Edited: 0005116
2020-11-19 12:19 geoffclare Note Added: 0005117
2020-11-19 13:39 joerg Note Added: 0005118
2020-11-19 13:40 joerg Note Edited: 0005118
2020-11-19 14:40 geoffclare Note Added: 0005119
2020-11-20 11:58 joerg Note Edited: 0005118


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker