[comp.unix.wizards] File checker: A summary

dsill@nswc-oas.arpa (Dave Sill) (07/23/88)

Previously, I wrote:
> Subject: File checker
> Is there a free utility that reads a file containing a list of files
> and their modes/owners/groups, compares them to the actual files, and
> either reports the inconsistencies or corrects them?  Just thought I'd
> check before I re-invent.

Following is a summary of the replies I've received to date.

1) Two people suggested short awk/ls/diff-based scripts.  For my
purposes, this is inadequate.  I need to check about 1500 files and
any form of shell script would just be too slow.

2) Three people mentioned that there is a nice script in "UNIX
Security" by Kochan and Wood that does this.  Again, too slow for me.

3) One person suggested that such a utility would be useful if it was
quick enough.

4) One person suggested trying `cfs' by Rex Sanders.  I was unable to
reach him.

5) One person suggested that the PD stat program might be useful.
True, but not a complete solution.

6) One person volunteered his own unfinished program to do this (Wade
Stebbings, wade@violet.berkeley.edu).  I would have taken him up on
this, had I not already received number 7...

7) Dave Curry gave me a copy of his program `fcc', File Consistency
Checker.  This turned out to be everything I wanted.  It consists of
two programs: fcc and fci.  Fci takes a list of files and produces a
data file for fcc based on the current stats of each file.  Fcc
compares the data file against the current file system and, depending
on how you call it and how you have your data file set up, reports
differences in mode, owner, group, file type, link count, size, and
modification time.  An option to fcc causes it to try to correct
owner, group, and mode inconsistencies.  On my unloaded tahoe it takes
30 seconds to check 1500+ files.  On a lightly loaded 780 it takes a
minute to check 1300+ files.

I've made several changes to fcc and fci, and have Dave's permission
to distribute copies of the source, which includes a makefile and man
pages, to anybody that wants them.  Drop me a line and I'll send you
the shar file.

Thanks to all who replied.

-Dave

henry@utzoo.uucp (Henry Spencer) (07/24/88)

In article <16608@brl-adm.ARPA> dsill@nswc-oas.arpa (Dave Sill) writes:
>1) Two people suggested short awk/ls/diff-based scripts.  For my
>purposes, this is inadequate.  I need to check about 1500 files and
>any form of shell script would just be too slow.

Did you try it?  It ain't necessarily so.  Ignoring the annoying problem
of argument lists being too long, this should be

	ls -... lotsafiles | awk '...' | diff - whatitoughttobe

which ought to be amply fast unless you're running this thing every five
minutes.  Kind of academic since you do have a C solution, but automatically
dismissing shell-and-filters solutions as "too slow" is a sign of ignorance.
Well-done shell programs are often fast enough.
-- 
MSDOS is not dead, it just     |     Henry Spencer at U of Toronto Zoology
smells that way.               | uunet!mnetor!utzoo!henry henry@zoo.toronto.edu

duane@cg-atla.UUCP (Andrew Duane X5993) (07/26/88)

In article <8807221517.aa00760@SEM.BRL.ARPA>, dsill@arpa.nswc-oas (Dave Sill) writes:
> 7) Dave Curry gave me a copy of his program `fcc', File Consistency
> Checker.  This turned out to be everything I wanted.
> 
> I've made several changes to fcc and fci, and have Dave's permission
> to distribute copies of the source, which includes a makefile and man
> pages, to anybody that wants them.  Drop me a line and I'll send you
> the shar file.
> -Dave

Dave:
	Sorry for the posting, but my mailer can't seem to find
you.... I am interested in the fcc/fci pair. It would be
valuable for many things, primarily for installation control on
our machines. Please mail me the shar file at one of the
addresses in my .signature below. (decvax or ulowell are usually
the best routes).

Andrew L. Duane (JOT-7)  w:(508)-658-5600 X5993  h:(603)-434-7934
Compugraphic Corp.			 decvax!cg-atla!duane
200 Ballardvale St.		       ulowell/ \laidback
Wilmington, Mass. 01887		   cbosgd!ima/   \cgeuro
Mail Stop 200II-3-5S		     ism780c/     \wizvax

Only my cat shares my opinions, and she's out pestering mice.

les@chinet.chi.il.us (Leslie Mikesell) (07/28/88)

In article <8807221517.aa00760@SEM.BRL.ARPA> @cam-cl.UUCP writes:
>> Subject: File checker
>> Is there a free utility that reads a file containing a list of files
>> and their modes/owners/groups, compares them to the actual files, and
>> either reports the inconsistencies or corrects them?  Just thought I'd
>> check before I re-invent.
>
I need two similar programs:
 1) something that will take a list of directories and list each with
the mod time of the most recently changed regular file underneath it.
It would be nice if it also compared these to a list stored in a file,
but that part would be easy to add.  This would be a quick check to
see if any archive copies are out of date.  I tend to compress/uncompress
files and move them around too much to tell anything by directory dates.

 2) something that will give the effect of "find dir -newer file -print",
but would catch files where the creation time is newer but the last
modification time is not.  I realize that is an odd condition, but the
AT&T starlan DOS server sets the mod time according to the PC clock which
is often not correct causing files to be missed in an incremental backup
based on find -newer.  The inode change time and last access time are
set from the unix clock, though, so reporting any files where the inode
change or the file modification time was later than the comparison file
should work.  A similar problem exists across RFS mounts also, but there
is no easy fix for that, other than keeping the clocks in sync, since
all three times are affected.

Les Mikesell