From: Sam Vilain (sam_at_vilain.net)
Date: Tue 12 Mar 2002 - 12:20:47 GMT
klavs klavsen <kl_at_vsen.dk> wrote:
> > My script is not tied to a distribution at all; it merely scans X
> > (where X >= 2) directory structures, and where files are identical in
> > the two structures, it hard links them (and optionally sets immutable
> > and immutable linkage invert inode attributes, btw thanks for the
> > chattr() routine).
> Watch out for the comparison. A file can look exactly alike, according
> to ls -l, and still not be the same. I would definetely do a sha1 or
> md5sum check to ensure that they are truely identical.
So would I. Read the source ;-).
I'm still not checking for race conditions (last minute updates), but I
think I might be able to do this by checking that the ctime hasn't changed
since the last checksum started.
> sounds very cool.. perhaps i'll have a look at making it log, which
> files it vunified - and then the next day, you could run it against the
> log, and it would tell you if anything changed - a very simple but
> effective IDS.
Check out the -v flag, which will only print out the new unifications that
It won't print anything when a file that was hard linked and indentical is
now a different file, however.
Patches are welcome. Even horrid hacks are welcome, but you get more
style points for writing good code.