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
0001231 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Objection Enhancement Request 2019-03-01 09:50 2024-06-11 09:08
Reporter stephane View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Stéphane Chazelas
Organization
User Reference
Section sed utility
Page Number 3218
Line Number 107963-107965
Interp Status Approved
Final Accepted Text Note: 0004408
Summary 0001231: backslash processing in text arguments
Description > The argument text shall consist of one or more lines.
> Each embedded <newline> in the text shall be preceded by
> a <backslash>. Other <backslash> characters in text shall
> be removed, and the following character shall be treated
> literally.

That means

sed 'a\
\text\
text'


for instance is *required* to output

text
text


at the end of the cycle.

That's not what several implementations including GNU and
busybox do even with POSIXLY_CORRECT in the environment, which
expand that \t to a TAB character.

That requirement is not useful and I don't expect any
application would rely on the POSIX-mandated behaviour.

There are also some variation in behaviour in:

sed 'a\
text\'


There are also some sed implementations (traditional ones like
on Solaris) that don't treat:

sed -e 'a\' -e 'text'


the same as

sed 'a\
text'


(same for sed -f a -f b, where a and b contain those two
expressions).
Desired Action Change the text above to:

> The argument text shall consist of one or more lines.
> Each embedded <newline> (other than the one for the last line
> of the text) in the text shall be preceded by a <backslash>.
> <backslash> may itself be escaped with another <backslash>,
> the behaviour is unspecified if an unescaped <backslash> is
> immediately followed by any other character or the end of a
> sed script or script_file (including if it's the last
> character of the last line of a script_file).

Though the part about \ at the end of script or script_files
should probably be addressed elsewhere as it affects other
commands than those that take those "text argument"s.

You may also want to clarify how backslash (including
<backslash><newline>) is meant to be handled in rfile, wfile
arguments as part of that same bug.
Tags tc3-2008
Attached Files

- Relationships

-  Notes
(0004408)
geoffclare (manager)
2019-06-06 15:59

Interpretation response
------------------------
The standard states the requirements for <backslash> handling in text arguments, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
-------------
The standard does not match some existing practice.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Change:
The argument text shall consist of one or more lines. Each embedded <newline> in the text shall be preceded by a <backslash>. Other <backslash> characters in text shall be removed, and the following character shall be treated literally.
to:
The argument text shall consist of one or more lines. A <backslash> in the text can be escaped with another <backslash>. The application shall ensure that each embedded <newline> (that is, those other than the terminating <newline> of the last line) in the text is preceded by an unescaped <backslash>. The behaviour is unspecified if an unescaped <backslash> is immediately followed by any character other than <backslash> or <newline>, or by the end of a script.
(0004606)
agadmin (administrator)
2019-10-07 15:17

Interpretation proposed: 7 October 2019
(0004650)
agadmin (administrator)
2019-11-11 12:20

Interpretation Approved: 11 Nov 2019

- Issue History
Date Modified Username Field Change
2019-03-01 09:50 stephane New Issue
2019-03-01 09:50 stephane Name => Stéphane Chazelas
2019-03-01 09:50 stephane Section => sed utility
2019-03-01 09:50 stephane Page Number => 3218
2019-03-01 09:50 stephane Line Number => 107963-107965
2019-06-06 15:59 geoffclare Note Added: 0004408
2019-06-06 16:00 geoffclare Interp Status => Pending
2019-06-06 16:00 geoffclare Final Accepted Text => Note: 0004408
2019-06-06 16:00 geoffclare Status New => Interpretation Required
2019-06-06 16:00 geoffclare Resolution Open => Accepted As Marked
2019-06-06 16:00 geoffclare Desired Action Updated
2019-06-06 16:00 geoffclare Tag Attached: tc3-2008
2019-10-07 15:17 agadmin Interp Status Pending => Proposed
2019-10-07 15:17 agadmin Note Added: 0004606
2019-11-11 12:20 agadmin Interp Status Proposed => Approved
2019-11-11 12:20 agadmin Note Added: 0004650
2019-12-04 11:51 geoffclare Status Interpretation Required => Applied
2024-06-11 09:08 agadmin Status Applied => Closed


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