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
0001823 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Comment Enhancement Request 2024-03-14 12:26 2024-05-16 15:55
Reporter mortoneccc View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Resolved  
Name Ed Morton
Organization
User Reference
Section awk
Page Number 0
Line Number 0
Interp Status ---
Final Accepted Text Note: 0006782
Summary 0001823: The impact of changing NR and/or FNR should be defined
Description In 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 Action Add 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.
---
Tags tc1-2024
Attached Files

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

-  Notes
(0006720)
mortoneccc (reporter)
2024-03-14 12:27

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.
(0006782)
geoffclare (manager)
2024-05-16 15:54

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 => Note: 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


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