bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13300: tail - backwards compatibility (tail +$line $filename)


From: Bob Proulx
Subject: bug#13300: tail - backwards compatibility (tail +$line $filename)
Date: Fri, 28 Dec 2012 16:45:56 -0700
User-agent: Mutt/1.5.20 (2009-06-14)

tag -1 notabug
close -1
thanks

Martyn Hare wrote:
> I think I've found a backwards-compatibility issue with tail.  I
> know that invoking tail without the -n argument when skipping lines
> (`tail +10 file.txt`) is bad syntax, but it needs to be supported
> for backwards-compatibility.
>
> Any chance you could allow the older "bad" way to use the command?

Yes.  Set _POSIX2_VERSION=199209 to obtain the previous behavior.
  
> For example, the Unreal Tournament GOTY installer by Loki Games
> depends on this style of syntax - and modern GNU tail breaks the
> script.

It is probably best to set the variable just for the installer.

  $ env _POSIX2_VERSION=199209 ./ut-installer

This is one of those frequently asked questions which has an FAQ entry
that talks about it in some detail:

  
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Old-tail-plus-N-syntax-now-fails

Also the topic is documented in the manual.  The manual says this:

     For compatibility `tail' also supports an obsolete usage `tail
  -[COUNT][bcl][f] [FILE]', which is recognized only if it does not
  conflict with the usage described above.  This obsolete form uses
  exactly one option and at most one file.  In the option, COUNT is an
  optional decimal number optionally followed by a size letter (`b', `c',
  `l') to mean count by 512-byte blocks, bytes, or lines, optionally
  followed by `f' which has the same meaning as `-f'.

     On older systems, the leading `-' can be replaced by `+' in the
  obsolete option syntax with the same meaning as in counts, and obsolete
  usage overrides normal usage when the two conflict.  This obsolete
  behavior can be enabled or disabled with the `_POSIX2_VERSION'
  environment variable (*note Standards conformance::).
  ...
     Newer versions of POSIX are occasionally incompatible with older
  versions.  For example, older versions of POSIX required the command
  `sort +1' to sort based on the second and succeeding fields in each
  input line, but starting with POSIX 1003.1-2001 the same command is
  required to sort the file named `+1', and you must instead use the
  command `sort -k 2' to get the field-based sort.

     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.

> P.S. Much love for all the hard work guys, I've not seen a single
> segfault in any release version of a GNU tool. Ever.

Yay!  Thanks for the feedback.  :-)

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]