Package: iwatch
Version: 0.2.1-3
Severity: important

not all listed event types to alert on actually do anything...eg modify, attrib 
etc

Theyre are listed in the code and and have configuration options for them.

The code simply doesnt look at the extra options.
I have written a patch which takes care of most of the missing ones.

I've also checked the latest version upstream which also is missing the 
requried code



-- System Information:
Debian Release: 5.0.4
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages iwatch depends on:
ii  libevent-perl            1.11-1          Generic Perl event loop
ii  liblinux-inotify2-perl   1:1.1-2.1+b1    scalable directory/file change not
ii  libmail-sendmail-perl    0.79-5          Send email from a perl script
ii  libxml-simpleobject-libx 0.53-1          Simple oo representation of an XML
ii  perl-modules             5.10.0-19lenny2 Core Perl modules
ii  postfix [mail-transport- 2.5.5-1.1       High-performance mail transport ag

iwatch recommends no packages.

iwatch suggests no packages.

-- no debconf information
--- ../iwatch-current/iwatch    2010-05-11 23:02:51.000000000 -0500
+++ ./iwatch    2010-05-11 22:56:14.000000000 -0500
@@ -74,7 +74,7 @@ my %InotifyEvents = (
   'isdir' => IN_ISDIR,
   'oneshot' => IN_ONESHOT,
   'all_events' => IN_ALL_EVENTS,
-  'default' => 
IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_MOVE|IN_DELETE_SELF|IN_MOVE_SELF,
+  'default' => 
IN_ATTRIB|IN_MODIFY|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_MOVE|IN_DELETE_SELF|IN_MOVE_SELF,
 );
 my %InotifyEventNames;
 foreach my $EventName (keys %InotifyEvents) {
@@ -334,15 +334,50 @@ sub mywatch {
     syslog("info","$Message") if($Path->{'syslog'});
   }
   if($e->IN_CREATE && -d $Filename && $Path->{'type'} eq "recursive") {
-    print STDERR "[$now] * Directory $Filename is watched\n" if($VERBOSE>0);
-    syslog("info","* Directory $Filename is watched") if($Path->{'syslog'});
-    print STDERR "Can't watch $Filename: $!\n"
-      if(!$inotify->watch ($Filename, $Path->{'mask'}, \&mywatch));
+    if (-d $Filename && $Path->{'type'} eq "recursive") {
+        print STDERR "[$now] * Directory $Filename is watched\n" 
if($VERBOSE>0);
+        syslog("info","* Directory $Filename is watched") 
if($Path->{'syslog'});
+        print STDERR "Can't watch $Filename: $!\n" if(!$inotify->watch 
($Filename, $Path->{'mask'}, \&mywatch));
+    }
+    elsif ($Path->{'type'} eq "recursive") {
+        $localMessage = "* $Filename created\n";
+        $Message = "$Message\n$localMessage";
+        $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename created";  
+        print STDERR "[$now] $localMessage" if($VERBOSE>0);
+        syslog("info","$localMessage") if($Path->{'syslog'});
+    }
+    $localMessage = "* $Filename opened for writing closed\n";
+    $Message = "$Message\n$localMessage";
+    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename opened for 
writing closed";  
+    print STDERR "[$now] $localMessage" if($VERBOSE>0);
+    syslog("info","$localMessage") if($Path->{'syslog'});
+    
+  }
+  elsif($e->IN_ACCESS) { 
+    $localMessage = "* $Filename accessed\n"; 
+    $Message = "$Message\n$localMessage"; 
+    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename accessed";   
+    print STDERR "[$now] $localMessage" if($VERBOSE>0); 
+    syslog("info","$localMessage") if($Path->{'syslog'}); 
+  } 
+  elsif($e->IN_ATTRIB) { 
+    $localMessage = "* $Filename attributes changed\n"; 
+    $Message = "$Message\n$localMessage"; 
+    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename attributes 
changed";   
+    print STDERR "[$now] $localMessage" if($VERBOSE>0); 
+    syslog("info","$localMessage") if($Path->{'syslog'}); 
+  }
+  elsif($e->IN_CLOSE_NOWRITE) {
+    $localMessage = "* $Filename opened for reading closed\n";
+    $Message = "$Message\n$localMessage";
+    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename opened for 
reading closed";  
+    print STDERR "[$now] $localMessage" if($VERBOSE>0);
+    syslog("info","$localMessage") if($Path->{'syslog'});
   }
   elsif($e->IN_CLOSE_WRITE && -f $Filename) {
-    $localMessage = "* $Filename is closed\n";
+    $localMessage = "* $Filename opened for writing closed\n";
     $Message = "$Message\n$localMessage";
-    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename is changed";  
+    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename opened for 
writing closed";  
     print STDERR "[$now] $localMessage" if($VERBOSE>0);
     syslog("info","$localMessage") if($Path->{'syslog'});
   }
@@ -353,6 +388,13 @@ sub mywatch {
     print STDERR "[$now] $localMessage" if($VERBOSE>0);
     syslog("info","$localMessage") if($Path->{'syslog'});
   }
+  elsif($e->IN_MODIFY) { 
+    $localMessage = "* $Filename modified\n"; 
+    $Message = "$Message\n$localMessage"; 
+    $Mail{Subject} = "[$PROGRAM] " . hostname() . ": $Filename modified";   
+    print STDERR "[$now] $localMessage" if($VERBOSE>0); 
+    syslog("info","$localMessage") if($Path->{'syslog'}); 
+  } 
   elsif($e->IN_MOVED_FROM || $e->IN_MOVED_TO) {
     if($e->IN_MOVED_FROM) {
       $Events{$e->{cookie}} = "$Filename";

Reply via email to