Skip to content

Commit

Permalink
Treat directory symlinks as files instead of directories
Browse files Browse the repository at this point in the history
This might fix RT#66491, the "symlink bug"
  • Loading branch information
abh committed Mar 15, 2011
1 parent c453372 commit 0e31fa8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/rrr-server
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ sub handle_file {

sub newdir {
my($inotify,$rf,$fullname,$batch) = @_;
return if -l $fullname;
my_inotify($inotify, $fullname);
# immediately inspect it, we certainly have missed the first
# events in this directory
Expand Down Expand Up @@ -159,12 +160,12 @@ sub handle_event {
} elsif ($ev->IN_DELETE_SELF || $ev->IN_MOVE_SELF) {
$ev->w->cancel;
warn "[$time] Delwatcher $reportname (@stringifiedmask)\n" if $Opt{verbose};
} elsif ($ev->IN_ISDIR) {
newdir($inotify,$rf,$fullname,$batch);
warn "[$time] Newwatcher $reportname (@stringifiedmask)\n" if $Opt{verbose};
} elsif (-l $fullname) {
handle_file($rf,$fullname,"new",$batch);
warn "[$time] Updatelink $reportname (@stringifiedmask)\n" if $Opt{verbose};
} elsif ($ev->IN_ISDIR) {
newdir($inotify,$rf,$fullname,$batch);
warn "[$time] Newwatcher $reportname (@stringifiedmask)\n" if $Opt{verbose};
} elsif (-f _) {
if ($ev->IN_CLOSE_WRITE || $ev->IN_MOVED_TO) {
handle_file($rf,$fullname,"new",$batch);
Expand All @@ -178,7 +179,7 @@ sub handle_event {

sub init {
my($inotify, $rootdir) = @_;
foreach my $directory ( File::Find::Rule->new->directory->in($rootdir) ) {
foreach my $directory ( File::Find::Rule->new->directory->not( File::Find::Rule->new->symlink )->in($rootdir) ) {
my_inotify($inotify, $directory);
}

Expand Down

0 comments on commit 0e31fa8

Please sign in to comment.