A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=1105 ====================================================================== Reported By: stephane Assigned To: ====================================================================== Project: 1003.1(2016)/Issue7+TC2 Issue ID: 1105 Category: Shell and Utilities Type: Enhancement Request Severity: Editorial Priority: normal Status: New Name: Stéphane Chazelas Organization: User Reference: Section: awk Page Number: Line Number: Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2016-12-05 21:52 UTC Last Modified: 2018-05-03 15:54 UTC ====================================================================== Summary: problems with backslashes in awk strings and EREs ======================================================================
---------------------------------------------------------------------- (0004019) geoffclare (manager) - 2018-05-03 15:54 http://austingroupbugs.net/view.php?id=1105#c4019 ---------------------------------------------------------------------- Interpretation response ------------------------ The standard states the requirements for handling of <backslash> in awk, 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 historical and current practice. Notes to the Editor (not part of this interpretation): ------------------------------------------------------- On page 2491 line 80125 section awk change:<blockquote>The awk utility shall make use of the extended regular expression notation (see [xref to XBD 9.4]) except that it shall allow the use of C-language conventions for escaping special characters within the EREs, as specified in the table in XBD Chapter 5 (on page 121) (<tt>'\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v'</tt>) and the following table; these escape sequences shall be recognized both inside and outside bracket expressions.</blockquote>to:<blockquote>The awk utility shall make use of the extended regular expression notation (see [xref to XBD 9.4]) except that it shall allow the use of C-language conventions for escaping special characters within the EREs, as specified in the table in XBD Chapter 5 (on page 121) for <tt>'\a', '\b', '\f', '\n', '\r', '\t', '\v'</tt> and in the following table for other sequences; these escape sequences shall be recognized both inside and outside bracket expressions.</blockquote> On page 2492 line 80136 section awk, change the Meaning column from:<blockquote><quotation-mark> character</blockquote>to:<blockquote>In the lexical token <b>STRING</b>, <quotation-mark> character. Otherwise undefined.</blockquote> On page 2492 line 80137 section awk, change the Meaning column from:<blockquote><slash> character</blockquote>to:<blockquote>In the lexical token <b>ERE</b>, <slash> character. Otherwise undefined.</blockquote> On page 2492 line 80143 section awk, add to the Description column:<blockquote>If the digits produce a value greater than octal 377, the behavior is undefined.</blockquote> On page 2492 line 80144 section awk, add two new rows to the table:<pre> \., \[, \(, \*, \+, | A <backslash> character followed by a character | In the lexical token <b>ERE</b>, the sequence \?, \{, \|, \^, \$ | that has a special meaning in EREs (see | shall represent itself. Otherwise undefined. | [xref to XBD 9.4.3]), other than <backslash>. | --------------------+-------------------------------------------------+----------------------------------------------------- \\ | Two <backslash> characters. | In the lexical token <b>ERE</b>, the sequence shall | | represent itself. In the lexical token <b>STRING</b>, | | it shall represent a single <backslash>. </pre> On page 2508 line 80877 section awk add a new first paragraph to APPLICATION USAGE:<blockquote>Since <backslash> has a special meaning both in the <assignment> option-argument to the <b>-v</b> option and in the <i>assignment</i> operand, applications that need to pass strings to <i>awk</i> without special interpretation of <backslash> should not use these methods but should instead make use of the <b>ARGV</b> or <b>ENVIRON</b> array.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2016-12-05 21:52 stephane New Issue 2016-12-05 21:52 stephane Name => Stéphane Chazelas 2016-12-05 21:52 stephane Section => awk 2018-04-25 22:27 McDutchie Note Added: 0003999 2018-04-26 08:53 joerg Note Added: 0004000 2018-04-30 09:59 geoffclare Note Added: 0004014 2018-04-30 10:39 stephane Note Added: 0004015 2018-04-30 11:06 McDutchie Note Added: 0004016 2018-04-30 11:26 geoffclare Note Added: 0004017 2018-04-30 12:00 stephane Note Added: 0004018 2018-04-30 12:05 stephane Note Edited: 0004018 2018-04-30 12:05 stephane Note Edited: 0004015 2018-04-30 12:28 McDutchie Note Edited: 0004016 2018-05-03 15:54 geoffclare Note Added: 0004019 ======================================================================