Bug 175907

Summary: "tail +10" no longer works
Product: [Fedora] Fedora Reporter: John Ellson <john.ellson>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: davej
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-02-06 04:45:21 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description John Ellson 2005-12-15 23:09:20 EST
Description of problem:
"tail +10"  no longer works

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

How reproducible:
100%

Steps to Reproduce:
1.tail +10 somefile
2.
3.
  
Actual results:
tail: cannot open `+10' for reading: No such file or directory.


Expected results:
all the lines in the file except the first 10

Additional info:
Even if someone has taken a dislike to this option, it is still required
for backward compatibility as many scripts use it.
Also, the option is still described in the man page.
Comment 1 Dave Jones 2005-12-15 23:15:43 EST
sort is similarly broken.
Comment 2 Tim Waugh 2005-12-16 04:50:03 EST
Here is what the tail man page actually says:

       -n, --lines=N
              output the last N lines, instead of the last 10
[...]
       If the first character of N (the number of bytes or lines)  is  a  ‘+’,
       print  beginning  with the Nth item from the start of each file, other-
       wise, print the last N items in the file.  N may have a multiplier suf-
       fix: b 512, k 1024, m 1024*1024.

So for tail, use 'tail -n +10'.  If you really must use the old 'tail +10'
syntax (which is no longer described in the man page), set
_POSIX2_VERSION=199209 in the environment.

For more information, see:

info coreutils "Standards Conformance"


*** This bug has been marked as a duplicate of 174624 ***
Comment 3 John Ellson 2005-12-16 06:19:18 EST
Here is what the tail man page actually says:

      -n, --lines=N
              output the last N lines, instead of the last 10
...
       If the first character of N (the number of bytes or lines)  is  a  ‘+’,
       print  beginning  with the Nth item from the start of each file, other-
       wise, print the last N items in the file.  N may have a multiplier suf-
       fix: b 512, k 1024, m 1024*1024.


$ rpm -qf /usr/share/man/man1/tail.1.gz
coreutils-5.93-4.1

Not only that, but "tail --help" says the thing.


The problem came up because Sun's JAI installation script fails.   Do you
really want to break hundreds of scripts by other vendors?  Why?

Please make _POSIX2_VERSION=199209 the default.
Comment 4 John Ellson 2005-12-16 06:26:40 EST
OK, I get it, if you read the man page like a lawyer, and without previous
knowledge, it doesn't actually say tail with an unadorned +N is permitted.

Given the previous 30year usage of tail I think it might be a little clearer
about the change.   It should also properly document the environment variable
setting
for bringing the previous behavior back.
Comment 5 John Ellson 2005-12-16 06:34:14 EST
The man page also doesn't describe -N, but "tail -30" works.
Comment 6 Red Hat Bugzilla 2007-02-05 14:05:05 EST
REOPENED status has been deprecated. ASSIGNED with keyword of Reopened is preferred.
Comment 7 Tim Waugh 2007-02-06 04:45:21 EST
The man page deliberately omits the description of this non-POSIX option form.