Bug 679831

Summary: --lines does not work: tailf: invalid option
Product: Red Hat Enterprise Linux 6 Reporter: Michal Nowak <mnowak>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: low Docs Contact:
Priority: low    
Version: 6.1CC: azelinka, jmarko, ohudlick, rvokal
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 17:10:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Nowak 2011-02-23 16:13:00 UTC
Description of problem:

Per

TAILF(1)

-n, --lines=N, -N
              output the last N lines, instead of the last 10.

[newman@dhcp-25-28 tmp]$ echo -e "XXX\nZZZ\nDDD" > file 
[newman@dhcp-25-28 tmp]$ cat file 
XXX
ZZZ
DDD
[newman@dhcp-25-28 tmp]$ tailf --lines=1 file 
tailf: invalid option
[newman@dhcp-25-28 tmp]$ echo $?
1

But:

[newman@dhcp-25-28 tmp]$ tailf -n 1 file 
DDD
^C

Works fine. So either --lines should be removed from tailf(1) man page of the code fixed (sources mention `--lines` option).

Version-Release number of selected component (if applicable):

util-linux-ng-2.17.2-10.el6.x86_64

How reproducible:

always

Comment 2 Karel Zak 2011-02-23 16:27:22 UTC
(In reply to comment #0) 
> -n, --lines=N, -N
>               output the last N lines, instead of the last 10.

The tailf(1) command supports --lines command line option, but without '=', for example:

   tailf --lines 1 file

It's bug in the man page. 

Ideal solution is to update the code and use the standard getopt() there.

Comment 4 Karel Zak 2011-03-18 08:45:12 UTC
The upstream commit dc181a2115e71ac9d8ff07375330c3652288f348 fixes this problem, unfortunately it's too invasive for RHEL. 

For RHEL will be better to fix the tailf(1) man page.

Comment 9 errata-xmlrpc 2011-12-06 17:10:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1691.html