[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail +n does not work under Linux?
From: |
Eric Blake |
Subject: |
Re: tail +n does not work under Linux? |
Date: |
Wed, 20 May 2009 06:33:45 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Christophe LYON on 5/12/2009 2:19 AM:
> On 11.05.2009 20:28, Bob Proulx wrote:
>> It is only because 'n' and 'N' are different cases of the same letter
>> that people's minds play tricks on them.
>
> Indeed.
> Maybe a slight rewording of the man page could highlight this?
> (eg add another reference to the info page for this trick)
What do you think about the attached patch to the --help output (and thus
man page)?
> After reading those 2 paragraphs several times, there are still a few
> things not completely clear:
> - tail -COUNT is described as obsolete, but supported when it does not
> conflict with the new standard. But has _POSIX2_VERSION any influence on
> this support?
In the latest coreutils, there is no influence. The POSIX folks made it
clear that while 'count -12' is no longer mandated (because it conflicts
with the argument guidelines, which state that 'app -12' is equivalent to
'app -1 -2' which is equivalent to 'app -2 -1' which is equivalent to 'app
- -21', but obviously 'count -12' and 'count -21' aren't equivalent), it is
also not forbidden. Yes, there was a window of coreutils releases where
this syntax was outright rejected, depending on _POSIX2_VERSION, but that
is no longer the case.
> - tail +COUNT is supported on "older systems". Older than what? How do I
> know whether I am using a "older system" or not?
"older systems" being those that failed to define _POSIX2_VERSION, or
defined it to the older value, or when you are using the environment
variable to select the older behavior.
>
> Is there a way to know which default POSIX version is used by coreutils?
> I have check the build logs, and saw nothing.
Look for something like this:
configure:12516: checking for desired default level of POSIX conformance
configure:12527: result: none-specified
In my case, I neither had the environment variable set at configure time,
nor did my system headers set _POSIX2_VERSION to either recognized value
(in other words, my system intentionally admits that it is not yet
compliant to either version). I guess there are three accepted values
these days, now that POSIX 2008 is finalized; maybe our docs need to be
updated to mention the value required by the latest POSIX version.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkoT+KkACgkQ84KuGfSFAYC+jACgp9GZK9xNe0dum1EhhAK46frZ
8ekAoNckxgnvJSWF+Smi2xrF1G5LzAqm
=ZFMV
-----END PGP SIGNATURE-----
>From 81556e44f12489532bd5a0c445dab12db4f3b115 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 20 May 2009 06:32:10 -0600
Subject: [PATCH] tail: make --help less ambiguous
* src/tail.c (usage): Use -n CNT, not -n N, to avoid confusion.
Reported by Chrisophe Lyon.
---
src/tail.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/tail.c b/src/tail.c
index fe34600..c58d830 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1,5 +1,6 @@
/* tail -- output the last part of file(s)
- Copyright (C) 1989, 90, 91, 1995-2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1989, 90, 91, 1995-2006, 2008-2009 Free Software
+ Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -226,8 +227,8 @@ With no FILE, or when FILE is -, read standard input.\n\
Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout);
fputs (_("\
- -c, --bytes=N output the last N bytes; alternatively, use +N to\n\
- output bytes starting with the Nth of each file\n\
+ -c, --bytes=CNT output the last CNT bytes; or, use +CNT to\n\
+ skip the first CNT-1 bytes of each file\n\
"), stdout);
fputs (_("\
-f, --follow[={name|descriptor}]\n\
@@ -237,8 +238,8 @@ Mandatory arguments to long options are mandatory for short
options too.\n\
-F same as --follow=name --retry\n\
"), stdout);
printf (_("\
- -n, --lines=N output the last N lines, instead of the last %d;\n\
- or use +N to output lines starting with the Nth\n\
+ -n, --lines=CNT output the last CNT lines, instead of the last
%d;\n\
+ or use +CNT to skip the first CNT-1 lines\n\
--max-unchanged-stats=N\n\
with --follow=name, reopen a FILE which has not\n\
changed size after N (default %d) iterations\n\
@@ -264,9 +265,9 @@ Mandatory arguments to long options are mandatory for short
options too.\n\
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
-If the first character of N (the number of bytes or lines) is a `+',\n\
-print beginning with the Nth item from the start of each file, otherwise,\n\
-print the last N items in the file. N may have a multiplier suffix:\n\
+If the first character of CNT (the number of bytes or lines) is a `+',\n\
+print beginning with the CNT item from the start of each file, otherwise,\n\
+print the last CNT items in the file. CNT may have a multiplier suffix:\n\
b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,\n\
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.\n\
\n\
--
1.6.3.rc3.2.g4b51
- tail +n does not work under Linux?, Christophe LYON, 2009/05/07
- Re: tail +n does not work under Linux?, Matthew Woehlke, 2009/05/07
- Re: tail +n does not work under Linux?, Christophe LYON, 2009/05/07
- Re: tail +n does not work under Linux?, Matthew Woehlke, 2009/05/07
- Re: tail +n does not work under Linux?, Christophe LYON, 2009/05/11
- Re: tail +n does not work under Linux?, Bob Proulx, 2009/05/11
- Re: tail +n does not work under Linux?, Christophe LYON, 2009/05/12
- Re: tail +n does not work under Linux?,
Eric Blake <=
- Re: tail +n does not work under Linux?, Jim Meyering, 2009/05/20
- Re: tail +n does not work under Linux?, Pádraig Brady, 2009/05/20
- Re: tail +n does not work under Linux?, Eric Blake, 2009/05/20
- Re: tail +n does not work under Linux?, Matthew Woehlke, 2009/05/20
- Re: tail +n does not work under Linux?, Eric Blake, 2009/05/29
- Re: tail +n does not work under Linux?, Pádraig Brady, 2009/05/29
- Re: tail +n does not work under Linux?, Jim Meyering, 2009/05/29
- Re: tail +n does not work under Linux?, Eric Blake, 2009/05/29
- Re: tail +n does not work under Linux?, Christophe LYON, 2009/05/20
Re: tail +n does not work under Linux?, Alfred M. Szmidt, 2009/05/08