History log of /freebsd-10.0-release/usr.bin/tail/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


251565 09-Jun-2013 jh

Print file names without stdio buffering to avoid mixing buffered and
unbuffered ouput.

PR: bin/176886
Reviewed by: mjg


248414 17-Mar-2013 joel

Remove EOL whitespace accidentally introduced in r248393.


248393 16-Mar-2013 joel

Add a couple of examples.

Obtained from: OpenBSD


245184 08-Jan-2013 delphij

Use calloc() to get zeroed memory.

MFC after: 1 month


227184 06-Nov-2011 ed

Add missing static keywords to tail(1)


224865 14-Aug-2011 jilles

tail: Fix crash if -F'ed file's filesystem disappears.

If tail notices that a file it is following no longer exists (because stat()
fails), it will output any final lines and then close the file. If the read
operation also causes an error, such as when the filesystem is forcefully
unmounted, it closes the file as well, leading to fclose(NULL) and a
segmentation fault.

PR: bin/159750
Submitted by: swills
Approved by: re (kib)
MFC after: 1 week


216370 11-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


201386 02-Jan-2010 ed

Build usr.bin/ with WARNS=6 by default.

Also add some missing $FreeBSD$ to keep svn happy.


201382 02-Jan-2010 ed

ANSIfy various tools in usr.bin/.

Most of these tools properly build at WARNS=6, except for their K&R
function declarations. Fix this, so we can bump WARNS as well.


198788 02-Nov-2009 brueffer

Use our canonical .Dd format.

Submitted by: Ulrich Spoerlein


193488 05-Jun-2009 brian

Change the behaviour of -F slightly; it now persists (forever) in
trying to open files rather than giving up when it encounters an
error. ENOENT errors are not reported.

As a result, files that are moved away then recreated are not at
risk of being 'lost' to tail. Files that are recreated and
temporarily have unreadable permissions will be shown when they
are fixed.

This behaviour is consistent with the GNU version of tail but
without the verbiage that goes with the GNU version.

This change also fixes error messages accompanying -f and -F.
They no longer report problems with (null)!

MFC after: 3 weeks


173838 22-Nov-2007 avatar

Nuking the temporary pointer once it is properly tracked in local storage.
This should fix the double free() bug where there's no tailing newline(\n)
character:

current# echo -n test | tail
testAssertion failed: (run->magic == ARENA_RUN_MAGIC), function
arena_dalloc, file /usr/src/lib/libc/stdlib/malloc.c, line 2448.
Abort (core dumped)

Reviewed by: kib
MFC after: 3 days


173285 02-Nov-2007 charnier

initialize variables, WARNS=6 compliant


172719 17-Oct-2007 kib

Fix various memory leaks.

Submitted by: rdivacky
Obtained from: OpenBSD
MFC after: 1 week


165527 24-Dec-2006 ru

Markup revision.


163587 21-Oct-2006 marcel

Better handle the -F case:
o When stat(2) fails (i.e. the file has been moved) there's no new
file with the same name yet, so keep showing the file that's open.
This yields the same behaviour as -f, for which we don't stat(2).
o When a new file with the same name has been created (i.e stat(2)
succeeds but the inode or device numbers differ from the opened
file), show any new lines in the opened file (i.e. the old or
rotated file) before reopening the new file.

These changes fix the observed behaviour that tail(1) doesn't show
the very last lines of the rotated (log) files.

PR: bin/101979
Tested by: Jos Backus <jos@catnook.com>
MFC after: 2 months


160049 30-Jun-2006 ru

- Simplify the formatting in the SYNOPSIS.
- Add the forgotten new option in usage().


160045 29-Jun-2006 flz

Add a -q option to suppress header lines when multiple files are specified.

Approved by: cperciva (mentor)
MFC after: 1 week


149485 26-Aug-2005 ps

Unbreak tail -f on non-local filesystems.


146882 01-Jun-2005 eivind

Back out revision 1.19 and 1.20 until I find mental clarity to deal with
issues bde pointed out.


146659 26-May-2005 eivind

Remove an errno reset that became unnecessary.

Noticed by: juli


146656 26-May-2005 eivind

We are past 4.4BSD - use our new-found stat flags for pipes and fifos.


143891 20-Mar-2005 iedowse

Don't skip the initialisation of tl->len when we hit an EOF immediately
after allocating a new buffer. This bug caused `tail -r < /dev/null'
to core dump when the `J' malloc option is set, and also affected
any other input that was an exact multiple of 128k.


141279 04-Feb-2005 delphij

Save last displayed file by having the "last" pointer global and save it
during we show the first file's tail. Instead of:

tarsier% tail -f 1 2
==> 1 <==
foo
bar

==> 2 <==
bar
foo

==> 2 <==
bar2
foo2

Now with this change, we have:

tarsier% tail -f 1 2
==> 1 <==
foo
bar

==> 2 <==
bar
foo
bar2
foo2

While I'm there, move a comment to where it should belong to. Also,
const'ify the "last" static because we will never need to change the
contents it points to.

MFC After: 1 week


140368 17-Jan-2005 ru

Added the EXIT STATUS section where appropriate.


140101 12-Jan-2005 brian

Don't reprint file names unnecessarily.

PR: 75028
Submitted by: mteterin at 250-217 dot customer dot cloud9 dot net
MFC after: 7 days


139995 10-Jan-2005 dwmalone

Bump WARNS to 4 as this seems OK on the alpha now.


139994 10-Jan-2005 dwmalone

Cast size_t to off_t before adding them to avoid warnings on the alpha.
Use %ld and intmax_t for printing an off_t.


139993 10-Jan-2005 dwmalone

Some variables became unused or global in the last change to this
file. Remove the now redundant declarations.

Add declarations for the new show and set_events functions and make
them static.


137225 04-Nov-2004 paul

Add support for following more than one file i.e.
tail -f file1 file2


137162 03-Nov-2004 paul

Revert a WIP change that shouldn't have been in last commit.


137157 03-Nov-2004 paul

Convert to ANSI style function definitions.


131491 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


118900 14-Aug-2003 dg

Removed check of st_rdev changing in the -F support. st_rdev for regular
files is usually the first direct block pointer. Since FreeBSD does
automatic block reallocation to reduce filesystem fragmentation, the
file being tailed can be relocated to different blocks 'on-the-fly',
making the check for st_rdev unreliable. The result of this bug is
tail -F pseudo-randomnly thinking the file was rotated when it wasn't,
and as a result, spews out the entire file trying to catch up.

MFC after: 3 days


116156 10-Jun-2003 markm

Revert part of the last commit. This fixes tail for pipes.

Submitted by: joerg


107901 15-Dec-2002 tjr

When doing tail -F, return if the freopen() of the file fails instead of
trying to use a null file pointer.


100063 15-Jul-2002 alfred

revert WARNS=4, it makes the alpha compile sad.


99983 14-Jul-2002 alfred

WARNS=4, add


98107 10-Jun-2002 jmallett

Note that this appeared at least as early as PWB UNIX.

Use the literal string 'PWB UNIX', as we still have no .At macro for it.


94609 13-Apr-2002 dwmalone

Fix up vendor IDs.
Put a sequence point between writing to a variable and using it.


94178 08-Apr-2002 murray

GCC 3.1 cleanup - add a break after default: at the end of a switch
statement.


92922 22-Mar-2002 imp

remove __P


87712 12-Dec-2001 markm

WARNS=2 fixes, use __FBSDID().


86888 25-Nov-2001 iedowse

Since kqueue support was added to tail, the "-F" option (check for
renames/rotations) only detected cases where the file itself was
moved or deleted. If part of the path to the file (or a symlink
in the path) was changed instead, tail would not notice.

Fix this by ensuring that we stat the path at least once every
second in the -F case to check for changes. We still use kqueue
when possible to inform us quickly when the file has changed.

PR: bin/24955
Submitted by: Maxim Konovalov <maxim@macomnet.ru>
MFC after: 1 week


84350 02-Oct-2001 fenner

Allow "obsolete" (but commonly-used) command line style to be used
with -F, e.g. tail -1 -F /var/log/messages.

Submitted by: Maxim Konovalov <maxim@macomnet.ru>


82762 01-Sep-2001 ache

File positions are off_t nowdays, not long, so:
long -> off_t
strtol -> strtoll
fseek -> fseeko

NOTE: that fseek not works for >long offsets files per POSIX:

[EOVERFLOW] For fseek( ), the resulting file offset would be a value which
cannot be represented correctly in an object of type long.


81687 15-Aug-2001 ru

mdoc(7) police: utilize the new .Ex macro.


79535 10-Jul-2001 ru

mdoc(7) police: removed HISTORY info from the .Os call.


77823 06-Jun-2001 jlemon

o If the file being tailed is moved back to the original location,
resume using kqueue to monitor it, if possible.
o auto-clear the read filter on EOF; this is needed when tailing a FIFO.


74933 28-Mar-2001 ache

Back out my fseeko -> fseek(END) change - we need to position on what we
displayed last, not to the end of file


74885 27-Mar-2001 ache

Restore part of my fix spammed in v1.23:
fseeko(file_size, SEEK_SET) -> fseek(0L, SEEK_END)
1) File may grows between operations, so fseeko to file_size may miss
2) 0L, SEEK_END is the same code using in tail in all other places


74876 27-Mar-2001 dwmalone

Fix tail to work on files bigger than 2GB.

PR: 14786
Reviewed by: iedowse


74863 27-Mar-2001 ache

Add comment explaining why size not passed directly to mmap, i.e. not relay
on its check.
KNF multi-line comments
(inspired by bde)


74834 27-Mar-2001 ache

Use SSIZE_MAX instead of INT_MAX, as kernel does ssize_t check
Better explanation comment of FIXME section


74830 26-Mar-2001 ache

Treat mmap() error as fatal too, i.e. do exit(1) instead of return


74827 26-Mar-2001 ache

rlines() checks:
1) really check for size overflow by checking negative value.
2) since mmap() not support files over INT_MAX size, add check for it
until either mmap() will be fixed or tail will be rewritted to handle
large files alternatively.
3) replace fseek(... file_size, SEEK_SET) with fseek(... 0L, SEEK_END)
to avoid off_t -> long cast
4) Use exit() if file is too big instead of warning and wrong logic
afterwards.


73231 28-Feb-2001 jlemon

Use EV_SET() macro to initialize kevent structure.


71514 24-Jan-2001 ru

Mention the -F in the usage().

PR: 24586
Submitted by: Cyrille Lefevre <clefevre@citeweb.net>


69552 03-Dec-2000 asmodai

Remove register keyword usage with prejudice.
Modern compilers are smarter when it comes to allocating register
usage.


69530 02-Dec-2000 asmodai

Use a size_t instead of an int.


69528 02-Dec-2000 asmodai

Properly constify some static arrays.

Also #if out some sccsid's and add rcsid's.


68963 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


63454 18-Jul-2000 jlemon

Convert calls to match new kqueue API.


61964 22-Jun-2000 jlemon

If the kevent() registration fails (probably due to the underlying
filesystem not being kq-aware), then fall back to using sleep. This
allows tail to work with NFS filesystems again without chewing up CPU time.

When given the -F flag, resort to sleep/stat after the file was moved
or deleted. This allows a window where the file being tailed does not
exist at all, which is typically the case during log rotation. Switch
back to using kq (if possible) after the file is reopened.


59373 18-Apr-2000 jlemon

Change <event.h> --> <sys/event.h>


59291 16-Apr-2000 jlemon

Change tail to use kqueue/kevent to obtain a notification when
the file changes (when doing tail -{f|F}).


58628 26-Mar-2000 charnier

Add DIAGNOSTICS section name


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


48792 12-Jul-1999 nik

Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

.\" $Id$
.\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by: bde


48566 04-Jul-1999 billf

Clean up some ambiguous nested if/elses.


37453 06-Jul-1998 bde

Fixed printf format errors.


35081 06-Apr-1998 peter

Add a new -F flag which is a superset of -f. It will cause tail to
stat() the file being followed and do a close/reopen if the file has been
renamed and/or rotated. This is damn useful for leaving running on files
in /var/log when newsyslog(8) rotates them.


31681 12-Dec-1997 ache

Change select(0, NULL, ...) to usleep()


30292 11-Oct-1997 phk

Fix a misleading comment. Rename a variable to make more sense.
Pointed out by by: bde


29460 15-Sep-1997 phk

Fix a comment.

Submitted by: Mikael Karpberg <karpen@ocean.campus.luth.se>


29402 14-Sep-1997 phk

In these days, waiting one full second for more to appear is far too long.
Let's try 250ms.


28150 13-Aug-1997 charnier

Remove trailing \n in warn() string.


24360 29-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


21786 16-Jan-1997 alex

Sweep through the tree fixing mmap() usage:

- Use MAP_FAILED instead of the constant -1 to indicate
failure (required by POSIX).
- Removed flag arguments of '0' (required by POSIX).
- Fixed code which expected an error return of 0.
- Fixed code which thought any address with the high bit set
was an error.
- Check for failure where no checks were present.

Discussed with: bde


17833 26-Aug-1996 adam

complete err() changes, actually use warn() in most instances


17826 25-Aug-1996 peter

Dont forget to #include <err.h>


17825 25-Aug-1996 peter

Argh! caught! *blush*.. This program was supplying it's own 'err' routine
which was slightly different to the libc one. To save any more cunfusion,
use the libc one.


17821 25-Aug-1996 peter

Fix some bogons:
- timeval in select loop was depending on not having the remaining time
returned from select(), causing a busy spin on an implementation that
does implement it.
- the err() usage was pretty bogus, some of the error messages had
strerror attached manually and then reattached by err().


17341 30-Jul-1996 adam

one file somehow slipped by me in the previous commit
tidy up


17339 30-Jul-1996 adam

when file can be opened for read but cannot be read from:
fail once (was twice) in forward case
fail once (was no times) in reverse case

this can happen when file is a directory on an NFS or procfs mount.


11411 10-Oct-1995 phk

Another program depending on zero'ed malloc.

Submitted by: Kai Vorma <vode@snakemail.hut.fi>


1591 27-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.