[Top][All Lists]

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

Re: Tail not accepting -c 123 anymore?

From: Paul Eggert
Subject: Re: Tail not accepting -c 123 anymore?
Date: Sat, 26 Mar 2005 21:43:42 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Mike Hearn <address@hidden> writes:

> In coreutils 5.3.0 tail happily accepted the -c switch with a space
> between the switch and the number. However in the new SuSE beta it does
> not unless you set _POSIX2_VERSION. Is this a change in coreutils CVS or
> something Novell have done? 

Could be a bit of both.  If Novell has changed the default
_POSIX2_VERSION in <unistd.h>, this will cause the default coreutils
behavior to change.

Another possibility is that you've run afoul of this change:

2004-09-23  Paul Eggert  <address@hidden>

        * src/tail.c (parse_obsolete_option): Bring back support
        for obsolete option followed by non-obsolete, or by more
        than one file.  When obsolete, conform to SUSv2 rather than
        original POSIX 1003.2-1992, as SUSv2 corrected the case of
        "tail -c".  Add support for the SUSv2 "b" modifier.
        * NEWS: Mention the above.

This change is required for conformance to SUSv2
<http://www.opengroup.org/onlinepubs/007908799/xcu/tail.html> which
says that "tail -c" must be treated like "tail -c 10"; hence "tail -c
123" must be treated like "tail -c 10 123", which causes the behavior
you're observing.  (This is how "tail" behaved in Unix Version 7,
circa 1978, so we're talking _real_ backward compatibility here.  :-)

To work around the problem, you can use "tail -c123".  This should be
portable between both old and new coreutils.  Or you can set
_POSIX2_VERSION=200112 in your environment; then you don't have to
worry about this particular backwards-compatibility mess.

> It isn't backwards compatible

Yes.  The problem is that the old coreutils wasn't backwards
compatible with SUSv2 (or with Unix Version 7, for that matter).  In
fixing that compatibility bug, we had to break compatibility with old
coreutils.  Sorry.

This mess may help to explain why I set _POSIX2_VERSION=200112 in my

reply via email to

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