Pending OpenSSH release, call for testing.

Bob Proulx bob at proulx.com
Tue Aug 17 15:23:18 EST 2004


Jason McCormick wrote:
> Damien Miller wrote:
> > > run test yes-head.sh ...
> > > head: -2000' option is obsolete; use -n 2000'
> >
> > That is just silly, did GNU deliberately break their head?

The -NUMBER format had been marked as obsolescent in POSIX
1003.2-1992.  The later POSIX 1003.1-2001 no longer allows it even as
an extension.

> GNU's coreutils is trying to comply with POSIX 1003.1-2001 compliant.  
> Supposedly the standard doesn't allow this.  Here's the blurb from the 
> info page:
> 
>      On older systems, head supports an obsolete option -countoptions,
>      which is recognized only if it is specified first. count is a 
>      decimal number optionally followed by a size letter (b, k, m) as in 
>      -c, or l to mean count by lines, or other option letters (cqv). 
>      POSIX 1003.1-2001 (see Standards conformance) does not allow this; 
>      use -c count or -n count instead.
> 
> The "see Standards conformance" references: 
> http://www.tug.org/texinfohtml/coreutils.html#Standards-conformance

The next paragraph is an important one:

     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 are
  running older software that assumes an older version of POSIX and
  uses `sort +1', `head -1', or `tail +1', you can work around the
  compatibility problems by setting `_POSIX2_VERSION=199209' in your
  environment.

Basically if libc defines _POSIX2_VERSION to be 200112 then
conformance to that standard is defined.  If _POSIX2_VERSION is
defined to be 199209 then conformance to that standard is defined.

  cd /usr/include
  grep _POSIX2_VERSION *.h
  unistd.h:#define _POSIX2_VERSION        200112L

So on my system the defined standards level is 200112 and in that
standard -NUMBER is not allowed.  I could refuse the 1003.1-2001
standard, set that define to 199209 and then recompile my system.
That would keep the old behavior.  I can also override that with an
environment variable to override the compiled in system default on a
process basis.

But whether you love them or hate them conformance to standards is
important.  I choose to conform.  Basically you get whatever behavior
you want and specify.  This is not a GNU thing but a POSIX standards
conformance thing.  If you want POSIX 1003.2-1992 behavior then define
that for your system.  You get to choose.

Bob




More information about the openssh-unix-dev mailing list