tail +N

I have noticed (at least on my systems) a difference between QNX/LINUX tail
results using tail +N

on LINUX tail+2 starts at record 2
on QNX it seems to skip two records and you need to do tail +1 to get the
same result.

Anyone know what’s going on?

“Bob Hollebeek” <bobh@nscp.upenn.edu> writes:

I have noticed (at least on my systems) a difference between QNX/LINUX tail
results using tail +N

on LINUX tail+2 starts at record 2
on QNX it seems to skip two records and you need to do tail +1 to get the
same result.

Anyone know what’s going on?

We have seen that as well between QNX4 and Linux. We have a build
system that depends on the behaviour of tail +N, and we have to have
separate scripts for QNX and Linux because of this. I’m not sure what
the “standard” behaviour is supposed to be, or if a standard exists at
all. The QNX4 behaviour seems more rational to me, but I’m a C
programmer and zero-based indexing is hard-wired in my brain now.

Cheers,
Andrew


Andrew Thomas, President, Cogent Real-Time Systems Inc.
2430 Meadowpine Boulevard, Suite 105, Mississauga, Ontario, Canada L5N 6S2
Email: andrew@cogent.ca WWW: http://www.cogent.ca

Bob Hollebeek <bobh@nscp.upenn.edu> wrote:

I have noticed (at least on my systems) a difference between QNX/LINUX tail
results using tail +N

on LINUX tail+2 starts at record 2
on QNX it seems to skip two records and you need to do tail +1 to get the
same result.

Anyone know what’s going on?

Hmmm… I did some testing:

QNX RTOS 6.1GA and QNX4.25D - start at record 3

BeOS5, Linux, BSD and Solaris - all start at record 2

I’ll have to investigate this one, check the POSIX specs and
talk to a few people. I’ll get back asap with the answer/solution to
your problem.

Thanks.

Regards,

Marcin

Tools Mail Account <tools@qnx.com> wrote:

Bob Hollebeek <> bobh@nscp.upenn.edu> > wrote:
I have noticed (at least on my systems) a difference between QNX/LINUX tail
results using tail +N

on LINUX tail+2 starts at record 2
on QNX it seems to skip two records and you need to do tail +1 to get the
same result.

Anyone know what’s going on?

Hmmm… I did some testing:

QNX RTOS 6.1GA and QNX4.25D - start at record 3

BeOS5, Linux, BSD and Solaris - all start at record 2

I’ll have to investigate this one, check the POSIX specs and
talk to a few people. I’ll get back asap with the answer/solution to
your problem.

This is a bug in the QNX implementation. 1003.2-1992 4.60.3 says that
+1 represents the first line in the file, so +2 should represent the
second line in the file not the third.


Eric Johnson
QA Mgr, QNX Software Systems Ltd.

Eric Johnson <eric@qnx.com> wrote:

Tools Mail Account <> tools@qnx.com> > wrote:
Bob Hollebeek <> bobh@nscp.upenn.edu> > wrote:
I have noticed (at least on my systems) a difference between QNX/LINUX tail
results using tail +N

on LINUX tail+2 starts at record 2
on QNX it seems to skip two records and you need to do tail +1 to get the
same result.

Anyone know what’s going on?

Hmmm… I did some testing:

QNX RTOS 6.1GA and QNX4.25D - start at record 3

BeOS5, Linux, BSD and Solaris - all start at record 2

I’ll have to investigate this one, check the POSIX specs and
talk to a few people. I’ll get back asap with the answer/solution to
your problem.

This is a bug in the QNX implementation. 1003.2-1992 4.60.3 says that
+1 represents the first line in the file, so +2 should represent the
second line in the file not the third.

Thanks Eric, I’ve submitted the bug report.

Regards,

Marcin


Eric Johnson
QA Mgr, QNX Software Systems Ltd.