Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 78897 - tail will not redirect output when given the option +n where n=number of lines from top of file
Summary: tail will not redirect output when given the option +n where n=number of line...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
: 159226 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-20 20:45 UTC by Paul Stillwell
Modified: 2006-12-27 10:51 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Stillwell 2005-01-20 20:45:11 UTC
Attempting to install SSHTerm Pro from
http://www.sshtools.com/products/applications/sshterm-pro/sshterm-pro.jsp

I get the following errors:
tail: cannot open `+260' for reading: No such file or directory

gunzip: sfx_archive.tar.gz: not in gzip format
tar: sfx_archive.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

System Details:

Linux Dufous 2.6.10-gentoo-r4 #1 Wed Jan 19 17:07:30 EST 2005 i686 AMD Athlon(tm) processor AuthenticAMD GNU/Linux
bash-2.05b$ tail --version
tail (coreutils) 5.2.1
Written by Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Reproducible: Always
Steps to Reproduce:
1.pick a text file (longer than 12 lines :-), it works with any file text or otherwise
2.issue the command tail +12 > filename.txt
3.

Actual Results:  
tail: cannot open `+12' for reading: No such file or directory 

Expected Results:  
a new file created that is missing the first 11 lines from the original 

This only happens when output is redirected using ">"  Not sure if this is a     
problem with tail or the shell.  I've tried it on SuSE 9.2 (AMD64) with the     
same version of Tail, but with BASH 3.00.0(1) and that works as expected.     
    
I was going to characterize this as a Blocker because it is preventing me from 
testing   both the SSHTerm Pro app listed above, and the "auto-installer" for  
SSL-Explorer SSL VPN on Gentoo  for a project I am working on.  
http://sourceforge.net/projects/sslexplorer/   But I discovered they have a 
tarball that I can play with.  None-the-less, tail, or perhaps bash seems 
broken 
    
I am not a programmer, but I have been using Linux for a long time and I am   
capable of testing and following instructions for gathering more info.  Please   
let me know what I need to do to help fix this.
Comment 1 Elfyn McBratney 2005-01-20 21:31:28 UTC
Hi,

The usage of some tools in the coreutils package (the package that provides head, tail, etc.) has changed to be more POSIX compliant.  "tail -n +260 foo/bar" will work, but "tail -10", or "tail +2" will either give off an depreciation error or die (like it did above).

The manual pages might be of help, but basically prior usage of "tail [-|+]N" needs to be converted to "tail -n [-|+]N".

Hope this helps :)
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-21 02:23:34 UTC
This behavior is correct.

If you need the old behavior for broken applications that can't be fixed to use 'tail -n [-+]N', there is a workaround. Run this for the workaround documentation:
info coreutils Standards conformance
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2006-12-27 10:01:57 UTC
*** Bug 159226 has been marked as a duplicate of this bug. ***
Comment 4 Willard Dawson 2006-12-27 10:51:42 UTC
Even if the accepted usage is `tail -n +N file`, the man page is confusing, if not contradictory.