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
0000865 [1003.1(2013)/Issue7+TC1] Shell and Utilities Objection Omission 2014-08-12 08:39 2019-06-10 08:54
Reporter antoinel View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Antoine Leca
Organization
User Reference
Section make
Page Number 2941
Line Number 97282-97286
Interp Status Approved
Final Accepted Text Note: 0002391
Summary 0000865: Use of % or $ in subst1 while expanding $(string1:subst1=[subst2]) should be avoided
Description Having either % or $ in subst1 in the $(string1:subst1=[subst2]) syntax lead to incompatible behaviour with several implementations of the utility: % is often used to trigger a pattern-matching-and-substitution feature, while $ often trigger further expansion of macros.

Since there are plans to enhance this syntax in future revisions of the Standard (like proposed in 0000519), it seems important to prevent non-portable use.
Desired Action In the paragraph which starts with:
Macro expansions using the forms $(string1 [: subst1 =[ subst2 ]]) or ${ string1 [: subst1 =[ subst2 ]]} [...]
Before the last sentence which reads as:
If string1 in a macro expansion contains a macro expansion, the results are unspecified.

Insert the following text:
The application shall ensure that subst1 or subst2 do not contain any <percent> or <dollar-sign> characters.
Tags tc2-2008
Attached Files

- Relationships
related to 0000519Appliedajosey 1003.1(2008)/Issue 7 Add to make macro variable pattern substitution (expansion), e.g., $(foo:%.o=%.c) 

-  Notes
(0002345)
antoinel (reporter)
2014-08-12 08:41
edited on: 2014-08-12 08:42

Alternatively to the text proposed, it might be more in line with the context to rather insert:
If the <percent-sign> or <dollar-sign> characters appears as part of
subst1 or subst2, the results are unspecified.

(0002346)
geoffclare (manager)
2014-08-12 11:13
edited on: 2014-08-14 14:41

Are there implementations where a % in subst2 is treated as special if there is no % in subst1? That would be surprising.

My reading of the current standard is that macro expansions in subst1 and subst2 must be supported. This is because line 97270 says "Macros can appear anywhere in the makefile" and lines 97280 and 97286 (one each for the two types of macro expansion) say the behaviour is unspecified if string1 in a macro expansion contains a macro expansion. Since line 97286 does not say the behaviour is unspecified if subst1 or subst2 contains a macro expansion, I believe the behaviour is specified (given line 97270). If there are implementations that don't support this, then we should consider changing line 97286.

If all of the major implementations support macro expansion in subst1 and subst2, and do not treat % as special in subst2 if there is no % in subst1, then the new text should be:
If a <percent-sign> character appears as part of subst1 after any macros have been recursively expanded, the results are unspecified.


Update: Solaris (10 and 11) does treat % as special in subst2 if there is no % in subst1. With:

OBJS = $(SRCS:.c=.%o)

it gives an error, "% missing from replacement macro reference". So I think the new text should be:
If a <percent-sign> character appears as part of subst1 or subst2 after any macros have been recursively expanded, the results are unspecified.


(0002347)
geoffclare (manager)
2014-08-12 11:15

By way of a reminder: whatever new text we add in TC2 for this bug, it will need to be modified by 0000519 for Issue 8.
(0002391)
geoffclare (manager)
2014-09-18 15:54
edited on: 2014-09-18 15:58

Interpretation response
------------------------
The standard states the requirements for macro substitution in make, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
-------------
Long standing existing practice is to treat a % in macro substitution as special (to perform pattern expansions).

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------

On page 2941 line 97280 section make

Change from:

If string1 in a macro expansion contains a macro expansion, the results are unspecified.

to:

If string1 in a macro expansion contains a macro expansion, the results are unspecified. If a <percent-sign> character appears as part of subst1 or subst2 after any macros have been recursively expanded, the results are unspecified.

On page 2954 line 97849 section make

Change the FUTURE DIRECTIONS section from:

None.

to:

A future version of this standard may require that macro expansions using the forms $(string1:[op]%[os]=[np][%][ns]) or ${string1:[op]%[os]=[np][%][ns]} are treated as pattern macro expansions.

(0002405)
ajosey (manager)
2014-10-06 07:44

Interpretation proposed 6 October 2014
(0002446)
ajosey (manager)
2014-11-27 10:31

Interpretation approved 27 November 2014

- Issue History
Date Modified Username Field Change
2014-08-12 08:39 antoinel New Issue
2014-08-12 08:39 antoinel Name => Antoine Leca
2014-08-12 08:39 antoinel Section => make
2014-08-12 08:39 antoinel Page Number => 2915
2014-08-12 08:39 antoinel Line Number => 95808
2014-08-12 08:41 antoinel Note Added: 0002345
2014-08-12 08:42 antoinel Note Edited: 0002345
2014-08-12 10:55 geoffclare Relationship added related to 0000519
2014-08-12 11:13 geoffclare Note Added: 0002346
2014-08-12 11:15 geoffclare Note Added: 0002347
2014-08-12 11:22 geoffclare Page Number 2915 => 2941
2014-08-12 11:22 geoffclare Line Number 95808 => 97282-97286
2014-08-12 11:22 geoffclare Interp Status => ---
2014-08-12 11:22 geoffclare Desired Action Updated
2014-08-12 14:26 geoffclare Note Edited: 0002346
2014-08-14 14:41 geoffclare Note Edited: 0002346
2014-09-18 15:54 geoffclare Note Added: 0002391
2014-09-18 15:58 geoffclare Note Edited: 0002391
2014-09-18 15:59 geoffclare Interp Status --- => Pending
2014-09-18 15:59 geoffclare Final Accepted Text => Note: 0002391
2014-09-18 15:59 geoffclare Status New => Interpretation Required
2014-09-18 15:59 geoffclare Resolution Open => Accepted As Marked
2014-09-18 16:00 geoffclare Tag Attached: tc2-2008
2014-10-06 07:44 ajosey Interp Status Pending => Proposed
2014-10-06 07:44 ajosey Note Added: 0002405
2014-11-27 10:31 ajosey Interp Status Proposed => Approved
2014-11-27 10:31 ajosey Note Added: 0002446
2019-06-10 08:54 agadmin Status Interpretation Required => Closed


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