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-03-14 12:27
Reporter mortoneccc View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Ed Morton
Organization
User Reference
Section awk
Page Number 0
Line Number 0
Interp Status ---
Final Accepted Text
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 No tags attached.
Attached Files

- Relationships

-  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.

- 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


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