Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
go ahead... be a heretic
 
PerlMonks  

Re^2: Monitor directories or files have any change

by benlaw (Scribe)
on Oct 28, 2005 at 05:19 UTC ( [id://503605]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Monitor directories or files have any change
in thread Monitor directories or files have any change

Thx for sauoq, it File::Signature suitable for direcotry and sub-directory? I have read the doc, but it seems it has not talk about it. Thanks
  • Comment on Re^2: Monitor directories or files have any change

Replies are listed 'Best First'.
Re^3: Monitor directories or files have any change
by sauoq (Abbot) on Oct 28, 2005 at 09:09 UTC

    That's a good question. The answer seems to be yes, but there may be caveats. It open()s the pathname for reading and uses Digest::MD5 to generate a fingerprint. Thinking about that, I'm really not sure if that behavior is well-defined. It doesn't seem to cause a problem on Linux at any rate. The fingerprint is the same as for an empty file. That's okay because the module also keeps info from stat() and that's what you are worried about when detecting whether a directory has changed. It checks the inode, mode, uid, gid, size, and mtime. If that's sufficient for you, I'd give it a go.

    I've used File::Signature on Solaris to create a tripwire-esque tool for monitoring data integrity but it wasn't for general use; it had a limited scope and I don't think the issue of monitoring directories ever came up.

    I've also just noticed that make test fails one test if you run it as root. It's not of any consequence though because it is testing an error condition which doesn't occur for root. Specifically, it is creating an unreadable file and testing the error returned when it tries to create a signature for the unreadable file. But, root can read it despite its mode, so there is no error and the test fails.

    -sauoq
    "My two cents aren't worth a dime.";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://503605]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.