Coreutils POSIX changes not documented in release notes

Bill Rugolsky Jr. brugolsky at telemetry-investments.com
Thu Mar 9 14:10:40 UTC 2006


On Thu, Mar 09, 2006 at 07:12:13PM +0530, Rahul Sundaram wrote:
> >      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.
> >
> >Sorry, I'm cranky.  Now I have to go put a wrapper around coreutils and
> >log old-style arguments.
> >
> The exact same text appears in the earlier Fedora Core  versions info 
> manuals. I am just puzzled at what has changed between FC4 and rawhide 
> versions now.

I apologize for being intemperate, Rahul.

The default version is now _POSIX2_VERSION=200112 not 199209.

So we are now conformant with a braindead standard.  The last time something
this stupid happened in scripting land was the BSD/SYSV "echo" divergence.
(Quiz: how does one portably echo?)

The problem with environment variables is that:

1. They are inherited, and so inflict collateral damage on code that may
   make conflicting use/assumptions.  In the specific case of sort and head,
   that's not too bad, since files beginning with '+' are rare (at least
   in any code written by paleolithic unix folk).

2. There are numerous ways that they can fail to be set.  The bash(1)
   INVOCATION section is telling.   Everyone who has written a non-trivial
   crontab entry has encountered the problem of differing environment.
   Any security-conscious program that carefully constructs its
   environment may fail recognize and propagate the variable.

Oh well, I'm not asking anyone to revert it.  But it is going to break a lot
of scripts that strip a header (| tail +2) and/or sorts (| sort +...).

A change like this really needs a mechanism to detect it.  I'm going to
end up patching coreutils to detect old-style argument usage conflicts,
log the command invocation (to syslog, I guess).

	Bill




More information about the fedora-docs-list mailing list