"tail +r<number>" not equivalent to "tail +<number> | rev -l" ?
Roland Mainz
roland.mainz at nrubsig.org
Sun May 24 04:39:55 PDT 2009
Hi!
----
[The following is either a PSARC or OS/Net gatekeeper question - I don't
know it exactly and therefore both end-up in the CC: field]
During PIT (=PreIntegration Testing) for ksh93-integration update2
(which includes an opensource replacement for /usr/bin/tail and
/usr/xpg4/bin/tail (note that both are built from the same source) - see
http://arc.opensolaris.org/caselog/PSARC/2009/249/20090420_roland.mainz.2)
we hit a bug with "tail -r/+r" and during fixing it we've hit the
following issue:
SXCE B110 tail(1) manual page defines "tail"'s "-r" option like this:
-- snip --
-r Reverse. Copies lines from the specified starting
point in the file in reverse order. The default for r
is to print the entire file in reverse order.
-- snip --
PSARC/2009/249 defines it the same way but with a shorter description:
-- snip --
-r, --reverse Output lines in reverse order.
-- snip --
Both AFAIK are thought that option "-r" works like "tail -<number> | rev
-l" ("rev -l" outputs the incoming lines in reverse order). The
/usr/bin/tail+/usr/xpg4/bin/tail commands in SXCE B110 does this
correctly when I use something like "-<number>r", for example:
-- snip --
$ print "1\n2\n3\n4\n5\n6" | /usr/xpg4/bin/tail
-4r
6
5
4
3
$ print "1\n2\n3\n4\n5\n6" | /usr/xpg4/bin/tail -4 | rev
-l
6
5
4
3
-- snip --
All other combinations for "-<number>" are identical between "tail
-<number>r" and "tail -<number> | rev -l", too.
However this is _not_ true when I use "tail +<number>r" compared to
"tail +<number> | rev -l". In that case the output differs:
-- snip --
$ print "1\n2\n3\n4\n5\n6" | /usr/xpg4/bin/tail
+4r
6
5
4
3
2
$ print "1\n2\n3\n4\n5\n6" | /usr/xpg4/bin/tail +4 | rev
-l
6
5
4
-- snip --
Both outputs differ and I belive this is simply a bug in the current
SXCE implementation.
Question to gatekeepers: How should I handle this issue ? Should we...
a) ... treat this as bug and fix it with the upcoming ksh93-integration
putback
or
b) ... make the AST/ksh93 builtin behave _exactly_ as the current SXCE
implementation of /usr/bin/tail+/usr/xpg4/bin/tail and fix this bug with
a later putback
or
c) ... declare that this is not a bug and keep the inconsistent
behaviour of "tail +<number>r" vs. "tail +<number> | rev -l".
AFAIK I would prefer [a] but I have a patch for [b], too. [c] is IMO not
really an option since makes option "r" behave in an inconsistent way.
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
More information about the opensolaris-arc
mailing list