--- xtail-2.1.orig/entryfuncs.c +++ xtail-2.1/entryfuncs.c @@ -75,6 +75,8 @@ entryp->fd = 0; entryp->size = 0; entryp->mtime = 0; + entryp->dev = 0; + entryp->ino = 0; return E_append(listp,entryp); } @@ -118,6 +120,8 @@ if (Reset_status) { entryp->size = 0; entryp->mtime = 0; + entryp->dev = 0; + entryp->ino = 0; } } --- xtail-2.1.orig/miscfuncs.c +++ xtail-2.1/miscfuncs.c @@ -107,6 +107,8 @@ } else { entryp->mtime = sbuf.st_mtime; entryp->size = sbuf.st_size; + entryp->dev = sbuf.st_dev; + entryp->ino = sbuf.st_ino; } } --- xtail-2.1.orig/xtail.1 +++ xtail-2.1/xtail.1 @@ -1,5 +1,5 @@ .\" $Id: xtail.1,v 2.2 1996/06/25 00:31:15 chip Exp $ -.TH XTAIL 1L +.TH XTAIL 1 .SH NAME xtail - Watch the growth of files. .SH SYNTAX @@ -31,9 +31,7 @@ tail(1) .SH NOTES .I Xtail -may be easily confused. For example, if a file is renamed, -.I xtail -may or may not continue to monitor it. If you ask it to monitor a file +may be easily confused. For example, if you ask it to monitor a file multiple times, it probably will. If you misspell a filename, .I xtail will treat it as a nonexistent entry and happily wait for its creation. --- xtail-2.1.orig/xtail.c +++ xtail-2.1/xtail.c @@ -22,7 +22,7 @@ { int open_files_only, already_open, iteration, i; struct entry_descrip *entryp; - struct stat sbuf; + struct stat sbuf, path_sbuf; /* * Initialize. @@ -61,6 +61,8 @@ move_entry(List_file, List_zap, last_entry(List_zap)); entryp->size = sbuf.st_size; entryp->mtime = sbuf.st_mtime; + entryp->dev = sbuf.st_dev; + entryp->ino = sbuf.st_ino; break; case ENTRY_DIR: /* move entry to dir list */ @@ -195,6 +197,20 @@ } /* + * See if an open file has been renamed. Occasionally do + * an extra stat on the file's name, and compare that to the + * info which fstat() returned. + */ + if (already_open && !open_files_only + && (stat(entryp->name, &path_sbuf) != 0 + || path_sbuf.st_dev != entryp->dev + || path_sbuf.st_ino != entryp->ino)) { + message(MSSG_RENAMED, entryp); + move_entry(List_zap, List_file, i--); + continue; + } + + /* * If nothing has changed then continue on. */ if (entryp->size==sbuf.st_size && entryp->mtime==sbuf.st_mtime) @@ -247,9 +263,11 @@ } /* - * Update the modification time. + * Update the other saved info about this entry. */ entryp->mtime = sbuf.st_mtime; + entryp->dev = sbuf.st_dev; + entryp->ino = sbuf.st_ino; /* * Since we've changed the mtime, the list might no longer be --- xtail-2.1.orig/xtail.h +++ xtail-2.1/xtail.h @@ -36,11 +36,6 @@ */ #define MAX_OPEN 8 -/* - * MAX_ENTRIES - This is *BOGUS* I should get rid of this. - */ -#define MAX_ENTRIES 512 - /***************************************************************************** @@ -75,12 +70,13 @@ #define MSSG_CREATED 2 /* file has been created */ #define MSSG_ZAPPED 3 /* file has been deleted */ #define MSSG_TRUNC 4 /* file has been truncated */ -#define MSSG_NOTAFIL 5 /* error - not a regular file or dir */ -#define MSSG_STAT 6 /* error - stat() failed */ -#define MSSG_OPEN 7 /* error - open() failed */ -#define MSSG_SEEK 8 /* error - lseek() failed */ -#define MSSG_READ 9 /* error - read() failed */ -#define MSSG_UNKNOWN 10 /* unknown error - must be last in list */ +#define MSSG_RENAMED 5 /* file has been renamed */ +#define MSSG_NOTAFIL 6 /* error - not a regular file or dir */ +#define MSSG_STAT 7 /* error - stat() failed */ +#define MSSG_OPEN 8 /* error - open() failed */ +#define MSSG_SEEK 9 /* error - lseek() failed */ +#define MSSG_READ 10 /* error - read() failed */ +#define MSSG_UNKNOWN 11 /* unknown error - must be last in list */ #ifdef INTERN @@ -113,6 +109,8 @@ int fd; /* opened fd, or <= 0 if not opened */ long size; /* size of entry last time checked */ long mtime; /* modification time last time checked */ + dev_t dev; /* device number last time, if file is opened */ + ino_t ino; /* inode number last time, if file is opened */ }; struct entry_list { @@ -171,6 +169,7 @@ "\n*** '%s' has been created ***\n", /*MSSG_CREATED*/ "\n*** '%s' has been deleted ***\n", /*MSSG_ZAPPED */ "\n*** '%s' has been truncated - rewinding ***\n", /*MSSG_TRUNC */ + "\n*** '%s' has been renamed - closing ***\n", /*MSSG_RENAMED */ "\n*** error - '%s' not a file or dir - removed ***\n", /*MSSG_NOTAFIL*/ "\n*** error - couldn't stat '%s' (%s) - removed ***\n",/*MSSG_STAT */ "\n*** error - couldn't open '%s' (%s) - removed ***\n",/*MSSG_OPEN */ --- xtail-2.1.orig/debian/TODO +++ xtail-2.1/debian/TODO @@ -0,0 +1,4 @@ +$Id: TODO,v 1.1 2008-06-24 15:26:26 roderick Exp $ + +- when a file is renamed you should pick up where you left off instead + of treating it as a new file, when possible --- xtail-2.1.orig/debian/changelog +++ xtail-2.1/debian/changelog @@ -0,0 +1,38 @@ +xtail (2.1-5) unstable; urgency=low + + * Note in debian/control that this isn't an X11 program (closes: + #426350). + + -- Roderick Schertler Tue, 24 Jun 2008 11:25:57 -0400 + +xtail (2.1-4) unstable; urgency=low + + * Add do-nothing binary/indep target (closes: #395763). + * Oops, files in directories given on the command line were output in + full due to a bug in code I'd introduced (closes: #368897) + + -- Roderick Schertler Sat, 18 Nov 2006 21:39:17 -0500 + +xtail (2.1-3) unstable; urgency=low + + * Drop /usr/doc symlink by rebuilding with newer debhelper (closes: + #359611). + * Note in the copyright file that that Chip Rosental really is the + author (closes: #302920). + * xtail.1: Change embedded section from "1L" to "1". + + -- Roderick Schertler Thu, 6 Apr 2006 10:25:06 -0400 + +xtail (2.1-2) unstable; urgency=low + + * Handle files which are renamed properly. + + -- Roderick Schertler Fri, 7 Dec 2001 09:16:54 -0500 + +xtail (2.1-1) unstable; urgency=low + + * Initial version (closes: #111309). + + -- Roderick Schertler Thu, 13 Sep 2001 17:23:10 -0400 + +$Id: changelog,v 1.5 2008-06-24 15:26:26 roderick Exp $ --- xtail-2.1.orig/debian/control +++ xtail-2.1/debian/control @@ -0,0 +1,21 @@ +Source: xtail +Section: utils +Priority: optional +Maintainer: Roderick Schertler +Standards-Version: 3.5.6 +Build-Depends: debhelper (>= 3.0.5) + +Package: xtail +Architecture: any +Depends: ${shlibs:Depends} +Description: like "tail -f", but works on truncated files, directories, more + xtail watches the growth of files. It's like running a "tail -f" on + a bunch of files at once. It notices if a file is truncated and starts + from the beginning. You can specify both filenames and directories on + the command line. If you specify a directory, it watches all the files + in that directory. It will notice when new files are created (and + start watching them) or when old files are deleted (and stop watching + them). + . + Note that xtail isn't a graphical (X11) program, it runs on a plain tty. + The name likely comes from "eXtended tail" or such. --- xtail-2.1.orig/debian/copyright +++ xtail-2.1/debian/copyright @@ -0,0 +1,62 @@ +$Id: copyright,v 1.3 2006-04-06 14:28:17 roderick Exp $ + +This is a Debian prepackaged version of xtail. It was put together by +Roderick Schertler with sources obtained from +. + +The source has been modified so that it handles files which are renamed +properly. + +The code is available under the terms of the BSD license. On Debian +systems, this license can be found in `/usr/share/common-licenses/BSD'. + +The original source distribution doesn't contain copyright terms. It +was written by Chip Rosenthal. Here's the response he sent me when I +contacted him about them: + +Return-Path: chip@chinacat.unicom.com +Delivery-Date: Wed Sep 5 21:09:49 2001 +Received: from junior.ibcinc.com (junior.ibcinc.com [198.22.130.72]) + by eeyore.ibcinc.com (8.8.5/8.8.5/1.9/ey-1.5) with ESMTP id VAA20093 + for ; Wed, 5 Sep 2001 21:09:48 -0400 (EDT) +Received: from janus.ibcinc.com (janus.ibcinc.com [198.22.130.130]) + by junior.ibcinc.com (8.8.5/8.8.5/1.9/jr-1.32) with SMTP id VAA01712 + for ; Wed, 5 Sep 2001 21:09:45 -0400 (EDT) +Received: (qmail 5716 invoked from network); 6 Sep 2001 01:09:44 -0000 +Received: from user5.net127.va.sprint-hsd.net (root@208.33.154.5) + by janus.ibcinc.com with SMTP; 6 Sep 2001 01:09:44 -0000 +Received: from coldsnap.unicom.com (coldsnap.unicom.com [192.108.105.33]) + by user5.net127.va.sprint-hsd.net (8.12.0.Beta7/8.12.0.Beta7/Debian 8.12.0.Beta7-1) with ESMTP id f8619hHA006843 + for ; Wed, 5 Sep 2001 21:09:43 -0400 +Received: from chinacat.unicom.com (chinacat.unicom.com [192.108.105.34]) + by coldsnap.unicom.com (8.11.0/8.11.0) with ESMTP id f8619e219673 + for ; Wed, 5 Sep 2001 20:09:40 -0500 +Received: (from chip@localhost) + by chinacat.unicom.com (8.11.0/8.10.1) id f8619bW05272 + for roderick@argon.org; Wed, 5 Sep 2001 20:09:37 -0500 +Date: Wed, 5 Sep 2001 20:09:37 -0500 +From: Chip Rosenthal +To: Roderick Schertler +Subject: Re: xtail package for Debian +Message-ID: <20010905200937.M1081@chinacat.unicom.com> +References: <5020.999696331@eeyore.ibcinc.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.2.5i +In-Reply-To: <5020.999696331@eeyore.ibcinc.com>; from roderick@argon.org on Wed, Sep 05, 2001 at 09:25:31AM -0400 + +On Wed, Sep 05, 2001 at 09:25:31AM -0400, Roderick Schertler wrote: +> I've been using xtail since the comp.sources.misc release, I find it +> invaluable. I'd like to package it for Debian, but I don't see +> copyright terms in the 2.1 release. Would you mind specifying your +> terms and making a new release (or just mailing them to me)? Thanks +> very much. + +You may use it under the terms of the BSD license. Does that work +for you? + +-- +Chip Rosenthal Now we buy spam at the grocery store, +http://www.unicom.com/ cause you can't eat the fish no more. + - Little Village --- xtail-2.1.orig/debian/rules +++ xtail-2.1/debian/rules @@ -0,0 +1,88 @@ +#!/usr/bin/make -f + +# $Id: rules,v 1.3 2006-11-19 02:47:51 roderick Exp $ + +dt := debian/xtail +stamp_build := debian/stamp.build +stamp_install := debian/stamp.install +clean := $(stamp_build) $(stamp_install) + +export CFLAGS := -O2 -Wall +ifneq "" "$(findstring debug,$(DEB_BUILD_OPTIONS))" + CFLAGS += -g +endif + +export DH_COMPAT := 3 +export DH_OPTIONS + +build: DH_OPTIONS := +build: $(stamp_build) +$(stamp_build): + dh_testdir + ./configure --mandir='$${prefix}/share/man' + $(MAKE) + touch $@ + +install: DH_OPTIONS := +install: $(stamp_install) +$(stamp_install): $(stamp_build) + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) prefix=`pwd`/$(dt)/usr install +# dh_movefiles + touch $@ + +clean: DH_OPTIONS := +clean: + dh_testdir + dh_testroot + [ ! -f Makefile ] || $(MAKE) distclean + dh_clean $(clean) + +binary-common: + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples + dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installman + dh_installcron + dh_installinfo +# dh_undocumented + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb + dh_perl + dh_shlibdeps + dh_gencontrol -u -isp + dh_md5sums + dh_builddeb + +# Build architecture independant packages using the common target. +# (Comment this out if you have none to build.) +#binary-indep: DH_OPTIONS=-i +#binary-indep: build install binary-common +binary-indep: + +# Build architecture dependant packages using the common target. +binary-arch: DH_OPTIONS=-a +binary-arch: build install binary-common + +# Any other binary targets build just one binary package at a time. +binary-%: build install + make -f debian/rules binary-common DH_OPTIONS=-p$* + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- xtail-2.1.orig/debian/watch +++ xtail-2.1/debian/watch @@ -0,0 +1,5 @@ +# $Id: watch,v 1.1 2006-04-06 14:28:26 roderick Exp $ + +version=2 + +http://www.unicom.com/sw/xtail/xtail-(\d.*)\.tar\.gz --- xtail-2.1.orig/debian/xtail.dirs +++ xtail-2.1/debian/xtail.dirs @@ -0,0 +1,2 @@ +usr/bin +usr/share/man/man1