Austin Group Bug Tracker
2014-04-17 15:25:56 UTC
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Under Review
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 15:25 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================
----------------------------------------------------------------------
(0002226) nick (manager) - 2014-04-17 15:25
http://austingroupbugs.net/view.php?id=226#c2226
----------------------------------------------------------------------
standardized,
Unix awk implementation should not necessarily be formally codified
in the standard. mawk, which was written based on the 1988 awk book,
also does not support this.
If there are awk programs that use this, they should best be changed to
have only one ';', in my humble opinion; there's no real added value
to codifying this into the language.
here is
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
======================================================================
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Under Review
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 15:25 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================
----------------------------------------------------------------------
(0002226) nick (manager) - 2014-04-17 15:25
http://austingroupbugs.net/view.php?id=226#c2226
----------------------------------------------------------------------
Subject: Re: [bug-gawk] use of ;; as terminator, request for grammar
helpDate: 17 April 2014 09:45:07 BST
X-Diagnostic: Not on the accept list
Hi Eric and Austin Group folks,
I apologize for the delay in replying. Real Life(tm) gets in the way
of these things.
I am cc'ing Brian Kernighan for his opinion on these issues as well.
visitedX-Diagnostic: Not on the accept list
Hi Eric and Austin Group folks,
I apologize for the delay in replying. Real Life(tm) gets in the way
of these things.
I am cc'ing Brian Kernighan for his opinion on these issues as well.
Date: Thu, 03 Apr 2014 10:18:54 -0600
Subject: [bug-gawk] use of ;; as terminator, request for grammar help
Hello GNU awk readers,
On today's Austin Group call (the people in charge of POSIX), we
Subject: [bug-gawk] use of ;; as terminator, request for grammar help
Hello GNU awk readers,
On today's Austin Group call (the people in charge of POSIX), we
http://austingroupbugs.net/view.php?id=226.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
Among other things, there were two action items pointed out that this
1. GNU awk has a bug regarding ;; as a terminator. The POSIX grammar
awk '{print};;{print}'
but gawk rejects this case. This was deemed to be a bug in gawk, since
POSIX was based on the nawk behavior at the time POSIX was
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
Among other things, there were two action items pointed out that this
1. GNU awk has a bug regarding ;; as a terminator. The POSIX grammar
awk '{print};;{print}'
but gawk rejects this case. This was deemed to be a bug in gawk, since
POSIX was based on the nawk behavior at the time POSIX was
and nawk has always supported this.
I'm not convinced this is a real bug. In particular, accidents of theUnix awk implementation should not necessarily be formally codified
in the standard. mawk, which was written based on the 1988 awk book,
also does not support this.
If there are awk programs that use this, they should best be changed to
have only one ';', in my humble opinion; there's no real added value
to codifying this into the language.
2. Based on existing implementations, there is consensus that the POSIX
awk '{print} {print}'
awk '/foo/; {print}'
since existing implementations all support it. But to do that, we need
someone with help in writing grammars to propose the changes to the one
appearing on the POSIX page. Any input would be appreciated.
I disagree with the first desired change. The ground I'm standing onawk '{print} {print}'
awk '/foo/; {print}'
since existing implementations all support it. But to do that, we need
someone with help in writing grammars to propose the changes to the one
appearing on the POSIX page. Any input would be appreciated.
firmer. The 1988 awk book disallowed rules without any separators, on
thegrounds that rules and statements within them should be syntactically
consistent (a semicolon is required when multiple Xs [rules or statments]
appearconsistent (a semicolon is required when multiple Xs [rules or statments]
on one line). And the very early released versions of nawk in fact
enforcedthis rule. (I remember testing against it.)
Later on, after the awk book, Brian changed his awk. If you look at his
FIXESLater on, after the awk book, Brian changed his awk. If you look at his
With fear and trembling, modified the grammar to permit
multiple pattern-action statements on one line without
an explicit separator. By definition, this capitulation
to the ghost of ancient implementations remains undefined
and thus subject to change without notice or apology.
DO NOT COUNT ON IT.
The sentiment here is quite clear - while it might work, it should
not be formalized.
The gawk documentation follows this example, documenting clearly that
a semicolon is required between multiple rules on one line, and NOT
documenting that it can be left off. I do not plan to change this,
either.multiple pattern-action statements on one line without
an explicit separator. By definition, this capitulation
to the ghost of ancient implementations remains undefined
and thus subject to change without notice or apology.
DO NOT COUNT ON IT.
The sentiment here is quite clear - while it might work, it should
not be formalized.
The gawk documentation follows this example, documenting clearly that
a semicolon is required between multiple rules on one line, and NOT
documenting that it can be left off. I do not plan to change this,
The second change (awk '/foo/; { print }') should be supported by the
POSIXgrammar, since that is clearly two different rules.
As an aside, there are one or two other areas where gawk implements
undocumented (= unspecified) behavior for compatibility with Unix awk,
but those remain purposely undocumented in the gawk manual; the case
/*
* A simple_stmt exists to satisfy a constraint in the POSIX
* grammar allowing them to occur as the 1st and 3rd parts
* in a `for (...;...;...)' loop. This is a historical oddity
* inherited from Unix awk, not at all documented in the AK&W
* awk book. We support it, as this was reported as a bug.
* We don't bother to document it though. So there.
*/
In my humble opinion, the ';;' issue is so trivial that it's not even
worthAs an aside, there are one or two other areas where gawk implements
undocumented (= unspecified) behavior for compatibility with Unix awk,
but those remain purposely undocumented in the gawk manual; the case
/*
* A simple_stmt exists to satisfy a constraint in the POSIX
* grammar allowing them to occur as the 1st and 3rd parts
* in a `for (...;...;...)' loop. This is a historical oddity
* inherited from Unix awk, not at all documented in the AK&W
* awk book. We support it, as this was reported as a bug.
* We don't bother to document it though. So there.
*/
In my humble opinion, the ';;' issue is so trivial that it's not even
the effort I put in for simple statements in for loops.
I hope all this helps. Further discussion is welcome.
Arnold
Issue HistoryI hope all this helps. Further discussion is welcome.
Arnold
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
======================================================================