BackupPC-users

Re: [BackupPC-users] Solution for Re: no cpool info shown on web interface

2008-04-13 15:41:32
Subject: Re: [BackupPC-users] Solution for Re: no cpool info shown on web interface
From: Bernhard Ott <bernhard.ott AT gmx DOT net>
To: backuppc-users AT lists.sourceforge DOT net
Date: Sun, 13 Apr 2008 21:41:29 +0200
Tino Schwarze wrote:
> On Sun, Apr 13, 2008 at 12:08:17PM +0200, Tino Schwarze wrote:
> 
>>> BTW, there are certain similarities in our setup:
>>> * 64bit linux
>>> * file system xfs/LVM/RAID
>> More info from my setup:
>> * Upgraded from 3.0.0 to 3.1.0 via configure.pl
>> * Perl version 5.8.8
>> * IO::Dirent 0.04 (but it's been there for a long time)
>> * everything working fine, except BackupPC_nightly
> * kernel 2.6.18.8-0.7-default (almost up-to-date openSUSE 10.2)
> 
> I found a problem. IO::Dirent returns 0 as the type for the directories,
> so BackupPC::Lib->find() doesn't descent into them. Why it does so if
> run manually - I don't know.
> 
> It does return a type 4 on ext3, on xfs it's always 0.
> 
> I used the following perl program to check:
> 
> #!/usr/bin/env perl
> #
> 
> use IO::Dirent;
> 
> foreach my $dir ( @ARGV) {
>         opendir DIR, $dir;
>         my @entries = readdirent(DIR);
>         closedir DIR;
> 
>         print "listing $dir:\n";
>         foreach my $entry ( @entries ) {
>                 print ("name: ", $entry->{name}, ", type: ", $entry->{type}, 
> ", inode: ", $entry->{inode}, "\n");
>         }
> }
> 
> I've rebuilt IO::Dirent, just to be sure - no change.
> 
> I found a fix for lib/BackupPC/Lib.pm (the line with "map {...}" is
> the relevant one):
> 
> --- lib/BackupPC/Lib.pm 2007-11-26 04:00:07.000000000 +0100
> +++ lib/BackupPC/Lib.pm       2008-04-13 12:52:03.938619979 +0200
> @@ -485,10 +485,15 @@
>  
>      from_to($path, "utf8", $need->{charsetLegacy})
>                          if ( $need->{charsetLegacy} ne "" );
> -    return if ( !opendir(my $fh, $path) );
> +    my ($fh);
> +    if ( !opendir($fh, $path) ) {
> +       print "log ERROR: opendir ($path) failed\n";
> +       return;
> +    }
> +
>      if ( $IODirentOk ) {
>          @entries = sort({ $a->{inode} <=> $b->{inode} } readdirent($fh));
> -        map { $_->{type} = 0 + $_->{type} } @entries;   # make type numeric
> +        map { $_->{type} = 0 + $_->{type}; $_->{type} = undef if ($_->{type} 
> eq BPC_DT_UNKNOWN); } @entries;   # make type numeric, unset unknown types
>      } else {
>          @entries = map { { name => $_} } readdir($fh);
>      }
> @@ -553,9 +559,11 @@
>      return if ( !chdir($dir) );
>      my $entries = $bpc->dirRead(".", {inode => 1, type => 1});
>      #print Dumper($entries);
> +    #print ("log got ",scalar(@$entries)," entries for $dir\n");
>      foreach my $f ( @$entries ) {
>          next if ( $f->{name} eq ".." || $f->{name} eq "." && $dontDoCwd );
>          $param->{wanted}($f->{name}, "$dir/$f->{name}");
> +        #if ( $f->{type} != BPC_DT_DIR ) { print ("log skipping 
> non-directory ", $f->{name}, " type: ", $f->{type}, "\n"); }
>          next if ( $f->{type} != BPC_DT_DIR || $f->{name} eq "." );
>          chdir($f->{name});
>          $bpc->find($param, "$dir/$f->{name}", 1);
> 
> HTH,
> 
> Tino.

Wow, I'm deeply impressed. I applied your patch the main problem seems
to be solved! I just found and opendir error in the logs:

> ERROR: opendir 
> (/var/lib/backuppc/pc/susexeon-mit_alles/401/f%2fraid/fWORK/fFISCHER) failed

This occurred only during the first run, now everything seems to work 
fine. Is it safe to leave the Lib.pm this way ;-)) ?

Thanks a lot for your help, it's great to know that there are 
specialists out there,

Bernhard

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/