View Issue Details

IDProjectCategoryView StatusLast Update
00018231003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2024-05-16 15:55
Reportermortoneccc Assigned To 
PrioritynormalSeverityCommentTypeEnhancement Request
Status ResolvedResolutionAccepted As Marked 
NameEd Morton
Organization
User Reference
Sectionawk
Page Number0
Line Number0
Interp Status---
Final Accepted Text0001823:0006782
Summary0001823: The impact of changing NR and/or FNR should be defined
DescriptionIn most, if not all, modern awks a user can change the value of NR and/or FNR and when the next record is read NR/FNR is incremented from the value the user set it to rather than from the value it previously had:

$ seq 3 | awk 'NR==2{NR=7; FNR=23} {print NR, FNR, $0}'
1 1 1
7 23 2
8 24 3

but that behavior is currently not defined by POSIX.
Desired ActionAdd statements to the spec like:
---
Assigning NR a whole number shall set NR to that value from that point on for processing of the current record and NR shall be incremented starting with that value for all subsequent records read. Assigning NR any other value is undefined behavior.
-
Assigning FNR a whole number shall set FNR to that value from that point on for processing of the current record and NR shall be incremented starting with that value for all subsequent records read. Assigning NR any other value is undefined behavior.
---
Tagstc1-2024

Relationships

related to 0001821 Interpretation Required Define the values of $0, $1, etc. in the END section 

Activities

mortoneccc

2024-03-14 12:27

reporter   bugnote:0006720

The "Assigning FNR ..." statement at the end of the Desired Action should of course say "and FNR shall be incremented" rather than "and NR shall be incremented", that was a copy/paste error.

geoffclare

2024-05-16 15:54

manager   bugnote:0006782

After applying bug 0001821, make the following change:

Page and line numbers are for Issue 8 draft 4.1.

After page 2642 line 86769 section awk (FUTURE DIRECTIONS), add a new paragraph:
A future version of this standard may specify the behavior when an application assigns a value to NR or FNR.

Issue History

Date Modified Username Field Change
2024-03-14 12:26 mortoneccc New Issue
2024-03-14 12:26 mortoneccc Name => Ed Morton
2024-03-14 12:26 mortoneccc Section => awk
2024-03-14 12:26 mortoneccc Page Number => 0
2024-03-14 12:26 mortoneccc Line Number => 0
2024-03-14 12:27 mortoneccc Note Added: 0006720
2024-05-16 15:54 eblake Relationship added related to 0001821
2024-05-16 15:54 geoffclare Note Added: 0006782
2024-05-16 15:55 geoffclare Interp Status => ---
2024-05-16 15:55 geoffclare Final Accepted Text => 0001823:0006782
2024-05-16 15:55 geoffclare Status New => Resolved
2024-05-16 15:55 geoffclare Resolution Open => Accepted As Marked
2024-05-16 15:56 geoffclare Tag Attached: tc1-2024