zsh-workers
 help / color / mirror / code / Atom feed
From: Vin Shelton <acs@alumni.princeton.edu>
To: Peter Stephenson <pws@csr.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: POSIX conformance in coreutils
Date: Wed, 12 Jan 2005 09:19:30 -0500	[thread overview]
Message-ID: <m33bx6wwzx.fsf@zion.rcn.com> (raw)
In-Reply-To: <200501121027.j0CAR12W018808@news01.csr.com> (Peter Stephenson's message of "Wed, 12 Jan 2005 10:27:01 +0000")

Peter Stephenson <pws@csr.com> writes:

> Vin Shelton wrote:
>> GNU coreutils (at least versions 5.2.1 and 5.3.0) enforce POSIX
>> conformance, so they don't like 'tail -1', instead they require
>> 'tail -n 1'.
>
> Might the environment variable POSIXLY_CORRECT be set?  That seems to be
> the effect here.  We could unset it explicitly if that's the case.
>
> Index: Test/ztst.zsh
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v
> retrieving revision 1.19
> diff -u -r1.19 ztst.zsh
> --- Test/ztst.zsh	26 Jul 2004 13:18:14 -0000	1.19
> +++ Test/ztst.zsh	12 Jan 2005 10:26:43 -0000
> @@ -28,6 +28,9 @@
>  [[ -n $LC_COLLATE ]] && LC_COLLATE=C
>  [[ -n $LANG ]] && LANG=C
>  
> +# POSIXLY_CORRECT can cause spurious error messages with "tail -<num>".
> +unset POSIXLY_CORRECT
> +
>  # Set the module load path to correspond to this build of zsh.
>  # This Modules directory should have been created by "make check".
>  [[ -d Modules/zsh ]] && module_path=( $PWD/Modules )
>

Hi Peter,

I checked and I do not have POSIXLY_CORRECT set.  Here's what the
'Standards conformance' section of the coreutils info says:

  In a few cases, the GNU utilities' default behavior is incompatible
  with the POSIX standard.  To suppress these incompatibilities, define
  the `POSIXLY_CORRECT' environment variable.  Unless you are checking
  for POSIX conformance, you probably do not need to define
  `POSIXLY_CORRECT'.

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

This sentence: "The GNU utilities normally conform to the version of
POSIX that is standard for your system" seems to indicate that some
kind of inference is going on.

I don't have a strong opinion about how we fix this.  Either one of
Stephane's proposed solutions works just as well.

  - Vin


  parent reply	other threads:[~2005-01-12 14:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12  1:01 Vin Shelton
2005-01-12  9:18 ` Stephane Chazelas
2005-01-12 16:12   ` POSIX conformance in Solaris Danek Duvall
2005-01-12 10:27 ` POSIX conformance in coreutils Peter Stephenson
2005-01-12 10:42   ` Stephane Chazelas
2005-01-12 14:19   ` Vin Shelton [this message]
2005-01-12 15:58     ` Peter Stephenson
2005-02-23 16:36       ` Oliver Kiddle
     [not found]         ` <okiddle@yahoo.co.uk>
2005-02-23 18:24           ` Peter Stephenson
2005-01-12 16:18     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m33bx6wwzx.fsf@zion.rcn.com \
    --to=acs@alumni.princeton.edu \
    --cc=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).