Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: POSIX conformance in coreutils
- X-seq: zsh-workers 20697
- From: Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: POSIX conformance in coreutils
- Date: Wed, 12 Jan 2005 09:19:30 -0500
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <200501121027.j0CAR12W018808@xxxxxxxxxxxxxx> (Peter Stephenson's message of "Wed, 12 Jan 2005 10:27:01 +0000")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: EtherSoft, Inc
- References: <m3r7kr31g9.fsf@xxxxxxxxxxxx> <200501121027.j0CAR12W018808@xxxxxxxxxxxxxx>
Peter Stephenson <pws@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author