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
0000262 [1003.1(2008)/Issue 7] Shell and Utilities Objection Clarification Requested 2010-06-17 15:19 2013-04-16 13:06
Reporter eblake View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Eric Blake
Organization Red Hat
User Reference ebb.sed
Section sed
Page Number 3153
Line Number 104774
Interp Status Approved
Final Accepted Text Note: 0000434
Summary 0000262: sed with multiple -e options
Description In practice, there are situations where it is difficult to write a sed script with embedded newlines, such as in a makefile rule. Most implementations of sed therefore support the notion of combining multiple -e options with newlines between the portions; so long as the final concatenated script is valid. However, the standard currently requires that each -e option have a valid script in isolation.

http://lists.gnu.org/archive/html/bug-gnu-utils/2010-06/msg00047.html [^]
Desired Action At line 104763, change:

  sed [−n] −e script [−e script]... [−f script_file]... [file...]
  sed [−n] [−e script]... −f script_file [−f script_file]... [file...]

to:

  sed [−n] −e script_frag [−e script_frag]... [−f script_file]... [file...]
  sed [−n] [−e script_frag]... −f script_file [−f script_file]... [file...]


At line 104774, change:

-e script Add the editing commands specified by the script option-argument to the end of the script of editing commands. The script option-argument shall have the same properties as the script operand, described in the OPERANDS section.

to:

-e script_frag Add the text specified by the script_frag option-argument, along with a newline, to the end of the script of editing commands. The final resulting script after all concatenations have been performed shall have the same properties as the script operand, described in the OPERANDS section.

At line 105140, add a new paragraph to RATIONALE:

When multiple -e script_frag options are present, an individual script_frag need not be a valid script so long as the concatenation of all fragments, with newline separators, is valid. This allows usages such as sed -e '1{' -e } inside of a makefile, where it is difficult to insert a manual newline.
Tags tc1-2008
Attached Files

- Relationships
related to 0000944Closed 1003.1(2013)/Issue7+TC1 sed: relax requirement for } to be preceded by newline 
related to 0000269Closedajosey 1003.1(2004)/Issue 6 sed addr in braces 

-  Notes
(0000430)
wpollock (reporter)
2010-06-17 19:08

The proposed change:
-e script_frag Add the text specified by the script_frag option-argument, along with a newline, to the end of the script of editing commands.

Doesn't really state what I think is desired, which according to the (proposed) rationale is that newlines are separators and not terminators. That is, with a single -e option no newlines are added to the script (and thus "sed [-n] -e script [file...]" behaves the same as "sed [-n] script [file...]". Also note that currently, "sed [-n] -e script script [file...]" is not allowed, so the phrase "add to the script" is misleading.

Perhaps a better wording would be this:

-e script The script option-argument shall have the same properties as the script operand, described in the OPERANDS section. If multiple instances of this option and argument are used, the script arguments are concatenated together with a newline separator between each fragment.
(0000434)
geoffclare (manager)
2010-06-24 16:07

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

Rationale:
-------------
None.

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

Change

    -e script
        Add the editing commands specified by the script
        option-argument to the end of the script of editing commands.
        The script option-argument shall have the same properties as
        the script operand, described in the OPERANDS section.
    -f script_file
        Add the editing commands in the file script_file to the end of
        the script.
    -n
        [...]

    Multiple -e and -f options may be specified. All commands shall be
    added to the script in the order specified, regardless of their
    origin.

to

    -e script
        Add the editing commands specified by the script
        option-argument to the end of the script of editing commands.
    -f script_file
        Add the editing commands in the file script_file to the end of
        the script of editing commands.
    -n
        [...]

    If any -e or -f options are specified, the script of editing
    commands shall initially be empty. The commands specified by
    each -e or -f option shall be added to the script in the order
    specified. When each addition is made, if the previous
    addition (if any) was from a -e option, a <newline> shall be
    inserted before the new addition. The resulting script shall
    have the same properties as the script operand, described in
    the OPERANDS section.
(0000511)
ajosey (manager)
2010-07-30 09:31

Comments/objections on the proposed interpretation are due by 31 Aug 2010

- Issue History
Date Modified Username Field Change
2010-06-17 15:19 eblake New Issue
2010-06-17 15:19 eblake Status New => Under Review
2010-06-17 15:19 eblake Assigned To => ajosey
2010-06-17 15:19 eblake Name => Eric Blake
2010-06-17 15:19 eblake Organization => Red Hat
2010-06-17 15:19 eblake User Reference => ebb.sed
2010-06-17 15:19 eblake Section => sed
2010-06-17 15:19 eblake Page Number => 3153
2010-06-17 15:19 eblake Line Number => 104774
2010-06-17 15:27 msbrown Interp Status => ---
2010-06-17 15:27 msbrown Final Accepted Text => see: Desired Action
2010-06-17 15:27 msbrown Type Error => Enhancement Request
2010-06-17 15:27 msbrown Status Under Review => Resolved
2010-06-17 15:27 msbrown Resolution Open => Future Enhancement
2010-06-17 19:08 wpollock Note Added: 0000430
2010-06-24 16:07 geoffclare Interp Status --- => Pending
2010-06-24 16:07 geoffclare Final Accepted Text see: Desired Action =>
2010-06-24 16:07 geoffclare Note Added: 0000434
2010-06-24 16:07 geoffclare Type Enhancement Request => Clarification Requested
2010-06-24 16:07 geoffclare Status Resolved => Interpretation Required
2010-06-24 16:07 geoffclare Resolution Future Enhancement => Accepted As Marked
2010-06-24 16:08 geoffclare Final Accepted Text => Note: 0000434
2010-07-30 09:31 ajosey Interp Status Pending => Proposed
2010-07-30 09:31 ajosey Note Added: 0000511
2010-09-03 06:23 ajosey Interp Status Proposed => Approved
2010-09-24 16:12 geoffclare Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Interpretation Required => Closed
2015-06-18 16:15 eblake Relationship added related to 0000944
2015-06-18 16:37 eblake Relationship added related to 0000269


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