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
0001422 [Issue 8 drafts] Shell and Utilities Objection Error 2020-11-18 13:49 2020-11-18 13:49
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
Page Number 2894-2895
Line Number 97277-97282
Final Accepted Text
Summary 0001422: The current definition for the += assingment is in conflict with existing behavior of make and unpredictable/error-prone
Description The += operator has been introduced in January 1986 by SunPro Make.
It is defined to behave the same way as the = operator (to use delayed
expansion) regardless of how the assigned macro has been used before.

The current text in the standard does not seem to be compatible to long
existing behavior and it would be higly error-prone in complex makefiles
in special if these makefiles make use of the include directive.

Complex makefiles that make use of the include directive usually have
previous macro assignments in files from global make-include directories.
The author of a specific makefile thus cannot easily know whether there
was a previous = or ::= assinment for a specific macro since this would
require to manually scan many include files. Even worse: Which makefiles
are included is not easy to predic in object oriented makefile systems
that include different makefiles depending on the content of make
macros. As a result, the current standard text would cause
unpredictable results of the whole.

It seems to be better and more flexible to introduce a new operator +:= or
:+= for immediate expansion of the string to append, or to document this
work-around using the helper macro VAR2:

VAR2 := $(VAR3)
VAR = some text
VAR += $(VAR2)

instead of

VAR = some text
VAR += $(VAR3)

to enforce quasi-immediate expansion of the appended text.

In order to avoid an incompatible change for gmake users, we could
permit gmake to continue to support its deviating bahavior for the
non-standad := operator and require the POSIX ::= operator to behave
in a predictable way as proposed in Desired Action below.

P.S.:

Immediate expansion cannot be seen as completely new behavior because
SunPro Make in January 1986 already introduced immediate assignment in
contrast to delayed assignment for this:

VAR :sh= command

which is an immediate command substitution that calls the shell once
at parse time and this construct has been in use since then (using
the echo command) to emulate the behavior that recently has been
standardized for ::=

This problem was discovered while implementing ::= for SunPro Make
Desired Action Change the text in line 97277-97282 to:

  If the macro named by string1 exists, then a <space> character followed
  by the unevaluated string2 shall be appended to the value currently
  assigned to the value of the macro named by string.



To make the standard compatible to the existing behavior.

Discuss the proposal for +:= or :+= and for the standard and write
a related proposal, or document the workaround mentioned above.
Tags No tags attached.
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2020-11-18 13:49 joerg New Issue
2020-11-18 13:49 joerg Name => Jörg Schilling
2020-11-18 13:49 joerg Page Number => 2894-2895
2020-11-18 13:49 joerg Line Number => 97277-97282


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