[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in 'tail' (coreutils 6.10) -- '+' option not working
From: |
Eric Blake |
Subject: |
Re: Bug in 'tail' (coreutils 6.10) -- '+' option not working |
Date: |
Sun, 20 Sep 2009 14:52:05 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Joshua White on 9/20/2009 9:46 AM:
> The '+' option appears not to be working as documented. From the man page:
> "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, otherwise, print
> the last N items in the file." I recall this working in previous versions.
Not a bug, but a difference in various versions of POSIX. From the NEWS file:
> A few usages still have behavior that depends on which POSIX standard is
> being conformed to, and portable applications should beware these
> problematic usages. These include:
>
> Problematic Standard-conforming replacement, depending on
> usage whether you prefer the behavior of:
> POSIX 1003.2-1992 POSIX 1003.1-2001
> sort +4 sort -k 5 sort ./+4
> tail +4 tail -n +4 tail ./+4
> tail - f tail f [see (*) below]
> tail -c 4 tail -c 10 ./4 tail -c4
> touch 12312359 f touch -t 12312359 f touch ./12312359 f
> uniq +4 uniq -s 4 uniq ./+4
>
> (*) "tail - f" does not conform to POSIX 1003.1-2001; to read
> standard input and then "f", use the command "tail -- - f".
You can also change behavior on the fly; read 'info coreutils standards',
which states:
> The GNU utilities normally conform to the version of POSIX that is
> standard for your system. To cause them to conform to a different
> version of POSIX, define the `_POSIX2_VERSION' environment variable to
> a value of the form YYYYMM specifying the year and month the standard
> was adopted. Two values are currently supported for `_POSIX2_VERSION':
> `199209' stands for POSIX 1003.2-1992, and `200112' stands for POSIX
> 1003.1-2001. For example, if you have a newer system but are running
> software that assumes an older version of POSIX and uses `sort +1' or
> `tail +10', you can work around any compatibility problems by setting
> `_POSIX2_VERSION=199209' in your environment.
> tail (GNU coreutils) 6.10
Consider upgrading; the latest stable version is 7.6, and has some fixes
in tail.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkq2lfQACgkQ84KuGfSFAYCGXACgzw0LfLpCpaxT6lSqiZLKGQrO
TroAnR6T2lDf4j5fCRD6JrsKfK3Av1zV
=qjk3
-----END PGP SIGNATURE-----