Austin Group Defect Tracker

Aardvark Mark III

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001204 [1003.1(2016)/Issue7+TC2] Shell and Utilities Objection Clarification Requested 2018-08-31 16:22 2018-08-31 16:22
Reporter salty-horse View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Ori Avtalion
User Reference
Section ed
Page Number 0
Line Number 0
Interp Status ---
Final Accepted Text
Summary 0001204: Vague wording as to the validity of s/RE command without trailing delimiter and replacement
Description The s (Substitute) command has the following format:

Under the heading "Commands in ed", the specification says:

  "If the closing delimiter of an RE or of a replacement string (for example, '/' ) in a g, G, s, v, or V command would be
  the last character before a <newline>, that delimiter can be omitted, in which case the addressed line shall be written.
  For example, the following pairs of commands are equivalent:

    s/s1/s2 s/s1/s2/p
    g/s1 g/s1/p
    ?s1 ?s1?"

The wording "the closing delimiter of an RE or of a replacement string" is vague, and can be read as either referring to both the RE and replacement fields of the s command, or just the last field (as it refers to both commands with one argument, and commands with two arguments).

The "s" example is of a command that includes both the RE and replacement, without the closing delimiter.
However, there is no example such as "s/s1" or "s/s1/".
It is not specified in the text if "s/s1" is a valid commands, or how should they behave - specifically, what should be the value of the replacement string.

In contrast, the specification for the ex utility clearly allows "s/s1", and describe how it should be handled:
  (quote from the "Substitute" section)
  "The trailing delimiter can be omitted from pattern or from repl at the end of the command line. [...]
  If only repl is not specified or is empty, the pattern shall be replaced by nothing."

Of the various ed implementation I surveyed, all of them allow for "s/s1", with the replacement string being empty.
One exception is GNU ed, which in the recent release 1.14.2 has decided that "s/s1" is invalid.
See [^]
Desired Action Clarify whether the partial command "s/s1" is valid, and how it should be interpreted.
Tags No tags attached.
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2018-08-31 16:22 salty-horse New Issue
2018-08-31 16:22 salty-horse Name => Ori Avtalion
2018-08-31 16:22 salty-horse Section => ed
2018-08-31 16:22 salty-horse Page Number => 0
2018-08-31 16:22 salty-horse Line Number => 0
2018-09-16 22:19 Antonio Diaz Issue Monitored: Antonio Diaz

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