View Issue Details

IDProjectCategoryView StatusLast Update
00008771003.1(2013)/Issue7+TC1Shell and Utilitiespublic2024-06-11 09:02
Reporterjoerg Assigned To 
PrioritynormalSeverityEditorialTypeEnhancement Request
Status ClosedResolutionAccepted As Marked 
NameJörg Schilling
Organization
User Reference
Sectiontail
Page Number3239
Line Number108597-108742
Interp Status---
Final Accepted Text0000877:0002425
Summary0000877: tail should support the -r option
DescriptionUNIX systems include support for tail -r since at least 1980.
The POSIX standard should follow existing practice.
Desired ActionChange line 108600 from:

       tail [−f] [−c number|−n number] [file]
to:
       tail [−f | -r] [−c number|−n number] [file]

After line 108631 add:

     -r Reverse. Copies lines from the specified starting
            point in the file in reverse order. The default for r
            is to print the entire file in reverse order.
Tagsissue8

Activities

geoffclare

2014-10-23 16:35

manager   bugnote:0002425

Last edited: 2014-10-30 15:18

On page 3239 line 108600 change from:
tail [-f] [-c number|-n number] [file]
to:
tail [-f] [-c number|-n number] [file]
tail -r [-n number] [file]

On page 3239 lines 108629-108632 change from:
-n number
This option shall be equivalent to -c number, except the starting location in the file shall be measured in lines instead of bytes. The origin for counting shall be 1; that is, -n +1 represents the first line of the file, -n -1 the last.

If neither -c nor -n is specified, -n 10 shall be assumed.
to:
-n number
If -r is not specified, this option shall be equivalent to -c number, except the starting location in the file shall be measured in lines instead of bytes. The origin for counting shall be 1; that is, -n +1 represents the first line of the file, -n -1 the last.

If -r is specified, number shall specify the number of lines to read (in reverse) from the end of the input file. The application shall ensure that number does not have a sign.

-r
Copy the lines in reverse order (last line first). If -n is specified, that many lines of the file, starting with the last line, shall be copied. If -n is not specified, every line of the input file shall be copied.

If none of the -c, -n or -r options is specified, -n 10 shall be assumed.


After line 108722 (page 3242), add a new paragraph to RATIONALE:

The functionality made available by tail -r has been historically provided on some systems by a separate utility (tac), although tac traditionally lacked support for -n to limit the output. While both <tt>tail -n$n | tac</tt> and <tt>tac | head -n$n</tt> can be used to output a fixed length of reversed line output, the standard developers decided that it was preferable to have a single utility <tt>tail -r -n$n</tt> for the same purpose. Furthermore, in deciding whether to standardize tac rather than tail -r, it was determined that more implementations that have achieved POSIX certification had already implemented tail -r as an extension.


shware_systems

2014-10-23 18:00

reporter   bugnote:0002426

I feel this should be tagged as Issue 8. As the proposal is a compromise of existing practice, as I heard the discussion, doesn't it need a sponsor and new reference implementation, or a citation of an existing reference implementation?

eblake

2014-10-23 18:34

manager   bugnote:0002427

Correct - since not all implementations support it yet, it must be Issue 8. However, among all implementations that currently support it, the proposal here captures the existing behavior, so those implementations serve as the reference implementation and we do not need any additional sponsor to standardize existing practice.

eblake

2014-10-23 22:44

manager   bugnote:0002428

Should we also add text to XRAT C.4.3 (page 3712, near line 127098) that explains why we chose 'tail -r' instead of 'tac' as the interface to standardize?

Issue History

Date Modified Username Field Change
2014-09-18 12:47 joerg New Issue
2014-09-18 12:47 joerg Name => Jörg Schilling
2014-09-18 12:47 joerg Section => tail
2014-09-18 12:47 joerg Page Number => 3239
2014-09-18 12:47 joerg Line Number => 108597-108742
2014-10-23 16:35 geoffclare Note Added: 0002425
2014-10-23 16:36 geoffclare Note Edited: 0002425
2014-10-23 18:00 shware_systems Note Added: 0002426
2014-10-23 18:34 eblake Note Added: 0002427
2014-10-23 22:44 eblake Note Added: 0002428
2014-10-30 15:08 shware_systems Tag Attached: issue8
2014-10-30 15:18 geoffclare Note Edited: 0002425
2014-10-30 15:19 geoffclare Interp Status => ---
2014-10-30 15:19 geoffclare Final Accepted Text => 0000877:0002425
2014-10-30 15:19 geoffclare Status New => Resolved
2014-10-30 15:19 geoffclare Resolution Open => Accepted As Marked
2020-04-03 14:55 geoffclare Status Resolved => Applied
2024-06-11 09:02 agadmin Status Applied => Closed