BackupPC-users

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

2008-04-14 14:04:02
Subject: Re: [BackupPC-users] Solution for Re: no cpool info shown on web interface
From: Tino Schwarze <backuppc.lists AT tisc DOT de>
To: "backuppc-users AT lists.sourceforge DOT net" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 14 Apr 2008 20:03:36 +0200
Hi Craig,

On Mon, Apr 14, 2008 at 06:33:19AM -0700, Craig Barratt wrote:

> > 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.
> 
> Good detective work.
> 
> There is a check in BackupPC::Lib that should catch this.
> I'm not sure why that check passes in this case.  Here's
> the code:

I've looked into that today (and already wrote on the -devel list about
it).

>     BEGIN {
>         eval "use IO::Dirent qw( readdirent DT_DIR );";
>         if ( !$@ && opendir(my $fh, ".") ) {
>             #
>             # Make sure the IO::Dirent really works - some installs
>             # on certain file systems don't return a valid type.
>             #
>             my $dt_dir = eval("DT_DIR");
>             foreach my $e ( readdirent($fh) ) {
>                 if ( $e->{name} eq "." && $e->{type} == $dt_dir ) {
>                     $IODirentOk = 1;
>                     last;
>                 }
>             }
>             closedir($fh);
>         }
>     };
> 
> Ah, I bet "." (where BackupPC is running) is on an ext3 file system,
> where is should be checking $TopDir.

Yes, that's what I figured out, too. When running from init script, "."
happened to be ext3, while my manual invocation was from xfs.

> Unfortunately this test is done before the config file has been read.
> I would guess that if you replace this line:
> 
>         if ( !$@ && opendir(my $fh, ".") ) {
> 
> with your hardcoded TopDir, eg:
> 
>         if ( !$@ && opendir(my $fh, "/data/BackupPC") ) {
> 
> then the correct thing should happen (IO::Dirent should be disabled).
> 
> If you can confirm that, 

I can confirm that this fix works as expected - BackupPC_nightly is
processing my pool, I've started the init script from /root.

> then the fix is I should delay the check on IO::Dirent until after
> TopDir is known.

With my patch applied, we could always use IO::Dirent (if it's
available) and handle the type==0 case gracefully - only if the type is
requested. I'm not sure, anybody would benefit, i.e. calls dirRead with
requesting inode and nlink only.

Bye,

Tino.

-- 
„Es gibt keinen Weg zum Frieden. Der Frieden ist der Weg.” (Mahatma Gandhi)

www.craniosacralzentrum.de
www.forteego.de

-------------------------------------------------------------------------
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/