On Tuesday 13 February 2007 18:32, Robert Nelson wrote:
> How about something like this:
>
>    bool do_read = false;
>
>    if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode)) {
> #ifdef HAVE_WIN32
>       do_read = !is_portable_backup(&ff_pkt->bfd) || ff_pkt->statp.st_size
> > 0;
> #else
>       do_read = ff_pkt->statp.st_size > 0;
> #endif
>    } else if (ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO ||
>          (!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type == FT_DIREND))
> { do_read = true;
>    }
>
>    if (do_read) {

Yes, I think that will work correctly.  

However, please check my logic, because I think the following does the same:

    if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode)) {
          do_read = !is_portable_backup(&ff_pkt->bfd) || ff_pkt->statp.st_size 
> 0;
    } else if (ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO ||
                (!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type == 
FT_DIREND))   { 
          do_read = true;
    }

    if (do_read) {

This works (currently, and probably for the imaginable future) because
only Win32 has the nonportable format.

Please modify the comment above the test to include the fact that on Win32 
nonportable
backups, we must explicitly read both directories and regular files, even if 
they 
are zero length, to properly save the permissions.

Thanks for figuring this out.  It is really tricky and shows the subtle 
problems one can 
run into when the basic API changes, as it did here where the BackupRead() 
actually not 
only saves the data but also the access permissions.  I'm not complaining about 
the
API, but rather amused with the subtleties.

>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:bacula-users-
> > [EMAIL PROTECTED] On Behalf Of Kern Sibbald
> > Sent: Tuesday, February 13, 2007 8:33 AM
> > To: Robert Nelson
> > Cc: bacula-users@lists.sourceforge.net
> > Subject: Re: [Bacula-users] Backing up and restoring Windows permissions
> >
> > On Tuesday 13 February 2007 11:29, Robert Nelson wrote:
> > > Ralf and I did some testing offline.  The problem is with zero length
> > > files, the error is in this code taken from save_file() in
> >
> > filed/backup.c
> >
> > >    /*
> > >     * Open any file with data that we intend to save, then save it.
> > >     *
> > >     * Note, if is_win32_backup, we must open the Directory so that
> > >     * the BackupRead will save its permissions and ownership streams.
> > >     */
> > >    if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode)
> > > && ff_pkt->statp.st_size > 0) ||
> > >          ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO ||
> > >          (!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type ==
> >
> > FT_DIREND))
> >
> > > {
> > >
> > > We never open the file or do a BackupRead if the file is zero length.
> > >
> > > Kern, can you see any problem if we just remove the ff_pkt-
> > >statp.st_size >
> > > 0 portion of the test?
> >
> > Yes, that might create some errors on portable Win32 and on Unix, and it
> > will
> > certainly cause extra overhead.  On those systems, if the filesize is
> > zero,
> > we do not want to open it.
> >
> > IMO, the if needs to be re-written so that the size test is used in all
> > cases
> > except for !is_portable_backup(...).
> >
> > Probably about 10-20 minutes of hard thought could produce an if that is
> > much
> > more understandable (or several ifs if that is what it takes to simplify
> > it).
> >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:bacula-users- [EMAIL PROTECTED] On Behalf Of
> > > > Ralf Ertzinger
> > > > Sent: Monday, February 12, 2007 11:52 PM
> > > > To: bacula-users@lists.sourceforge.net
> > > > Subject: Re: [Bacula-users] Backing up and restoring Windows
> >
> > permissions
> >
> > > > Hi.
> > > >
> > > > On Mon, 12 Feb 2007 22:48:21 -0800, Robert Nelson wrote:
> > > > > Are you running an antivirus program?  If so, does it still happen
> >
> > if
> >
> > > > > the antivirus is disabled?
> > > >
> > > > There is no AV program on the Windows machine.
> > > >
> > > > > Do you have the portable option set to yes in the FileSet resource?
> > > > > If so, does it occur if you remove it?
> > > >
> > > > To the best of my knowledge this option is not set. The configuration
> > > > sections relevant to the machine in question are below.
> > > >
> > > > Is there a way to see (in the storage) whether the permissions were
> > > > even saved? bls does not seem to tell me that, it just lists UNIX
> > > > style permissions.
> > > >
> > > >
> > > >
> > > > Director config:
> > > >
> > > > Director {                            # define myself
> > > >   Name = banea-dir
> > > >   DIRport = 9101                # where we listen for UA connections
> > > >   QueryFile = "/usr/libexec/bacula/query.sql"
> > > >   WorkingDirectory = "/var/lib/bacula"
> > > >   PidDirectory = "/var/run"
> > > >   Maximum Concurrent Jobs = 1
> > > >   Password = "GVAslILAQw69HBIVsrX8egWouulz9d58q3DogOPExPnz"         #
> > > > Console password
> > > >   Messages = Daemon
> > > > }
> > > > JobDefs {
> > > >   Name = "DefaultJob"
> > > >   Type = Backup
> > > >   Level = Incremental
> > > >   Client = banea-fd
> > > >   FileSet = "Full Set"
> > > >   Schedule = "WeeklyCycle"
> > > >   Storage = File
> > > >   Messages = Standard
> > > >   Pool = Default
> > > >   Priority = 10
> > > > }
> > > > Job {
> > > >     Name = "w2k"
> > > >     client = w2k-fd
> > > >     jobdefs = "DefaultJob"
> > > >     FileSet = "w2k-set"
> > > > }
> > > > Job {
> > > >   Name = "BackupCatalog"
> > > >   JobDefs = "DefaultJob"
> > > >   Level = Full
> > > >   FileSet="Catalog"
> > > >   Schedule = "WeeklyCycleAfterBackup"
> > > >   # This creates an ASCII copy of the catalog
> > > >   RunBeforeJob = "/usr/libexec/bacula/make_catalog_backup bacula
> >
> > bacula"
> >
> > > >   # This deletes the copy of the catalog
> > > >   RunAfterJob  = "/usr/libexec/bacula/delete_catalog_backup"
> > > >   Write Bootstrap = "/var/lib/bacula/BackupCatalog.bsr"
> > > >   Priority = 11                   # run after main backup
> > > > }
> > > > Job {
> > > >   Name = "RestoreFiles"
> > > >   Type = Restore
> > > >   Client=banea-fd
> > > >   FileSet="Full Set"
> > > >   Storage = File
> > > >   Pool = Default
> > > >   Messages = Standard
> > > > }
> > > > Fileset {
> > > >     Name = "w2k-set"
> > > >     Include {
> > > >         Options {
> > > >             signature = MD5
> > > >         }
> > > >         File = "C:/TEMP"
> > > >     }
> > > > }
> > > > Schedule {
> > > >   Name = "WeeklyCycle"
> > > >   Run = Full 1st sun at 23:05
> > > >   Run = Differential 2nd-5th sun at 23:05
> > > >   Run = Incremental mon-sat at 23:05
> > > > }
> > > > Schedule {
> > > >   Name = "WeeklyCycleAfterBackup"
> > > >   Run = Full sun-sat at 23:10
> > > > }
> > > > FileSet {
> > > >   Name = "Catalog"
> > > >   Include {
> > > >     Options {
> > > >       signature = MD5
> > > >     }
> > > >     File = /var/lib/bacula/bacula.sql
> > > >   }
> > > > }
> > > > Client {
> > > >   Name = w2k-fd
> > > >   Address = ADDIX-RE-W2K.addix.campus
> > > >   FDPort = 9102
> > > >   Catalog = MyCatalog
> > > >   Password = "12345"      # password for FileDaemon
> > > >   File Retention = 30 days            # 30 days
> > > >   Job Retention = 6 months            # six months
> > > >   AutoPrune = yes                     # Prune expired Jobs/Files
> > > > }
> > > > Storage {
> > > >   Name = File
> > > >   Address = banea.int.addix.net                # N.B. Use a fully
> > > > qualified name here
> > > >   SDPort = 9103
> > > >   Password = "3mhDDbTYzDcvOmRNKLf1wOlZ5PIjeFHbz2RLqbvDnFzG"
> > > >   Device = FileStorage
> > > >   Media Type = File
> > > > }
> > > > Catalog {
> > > >   Name = MyCatalog
> > > >   dbname = bacula; user = bacula; password = bacula
> > > > }
> > > > Messages {
> > > >   Name = Standard
> > > >   mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) %r\" -s
> > > > \"Bacula: %t %e of %c %l\" %r"
> > > >   operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\)
> > > > %r\"
> >
> > -s
> >
> > > > \"Bacula: Intervention needed for %j\" %r"
> > > >   mail = [EMAIL PROTECTED] = all, !skipped
> > > >   operator = [EMAIL PROTECTED] = mount
> > > >   console = all, !skipped, !saved
> > > >   append = "/var/lib/bacula/log" = all, !skipped
> > > > }
> > > > Messages {
> > > >   Name = Daemon
> > > >   mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) %r\" -s
> > > > \"Bacula daemon message\" %r"
> > > >   mail = [EMAIL PROTECTED] = all, !skipped
> > > >   console = all, !skipped, !saved
> > > >   append = "/var/lib/bacula/log" = all, !skipped
> > > > }
> > > >
> > > > Pool {
> > > >   Name = Default
> > > >   Pool Type = Backup
> > > >   Recycle = yes                       # Bacula can automatically
> >
> > recycle
> >
> > > > Volumes
> > > >   AutoPrune = yes                     # Prune expired volumes
> > > >   Volume Retention = 365 days         # one year
> > > > }
> > > > Console {
> > > >   Name = banea-mon
> > > >   Password = "yktXPUIdRLEz4qrmn8HXgixUfR+pRdiyK2RXK3t3949T"
> > > >   CommandACL = status, .status
> > > > }
> > > >
> > > >
> > > > FileDaemon config on the Windows machine:
> > > > #
> > > > # Default  Bacula File Daemon Configuration file
> > > > #
> > > > #  For Bacula release 2.0.2 (01/28/07) -- Windows MVS
> > > > #
> > > > # There is not much to change here except perhaps the
> > > > # File daemon Name
> > > > #
> > > >
> > > > #
> > > > # "Global" File daemon configuration specifications
> > > > #
> > > > FileDaemon {                            # this is me
> > > >   Name = addix-re-w2k-fd
> > > >   FDport = 9102                # where we listen for the director
> > > >   WorkingDirectory = "C:\\Dokumente und Einstellungen\\All
> > > > Users\\Anwendungsdaten\\Bacula\\Work"
> > > >   Pid Directory = "C:\\Dokumente und Einstellungen\\All
> > > > Users\\Anwendungsdaten\\Bacula\\Work"
> > > >   Maximum Concurrent Jobs = 2
> > > > }
> > > >
> > > > #
> > > > # List Directors who are permitted to contact this File daemon
> > > > #
> > > > Director {
> > > >   Name = banea-dir
> > > >   Password = "12345"
> > > > }
> > > >
> > > > #
> > > > # Restricted Director, used by tray-monitor to get the
> > > > #   status of the file daemon
> > > > #
> > > > Director {
> > > >   Name = addix-re-w2k-mon
> > > >   Password = "dsB8PGsI0gX2KuH/LWmHUmqk0vlY/NRyd5B9BAHAKz65"
> > > >   Monitor = yes
> > > > }
> > > >
> > > > # Send all messages except skipped files back to Director
> > > > Messages {
> > > >   Name = Standard
> > > >   director = banea-dir = all, !skipped, !restored
> > > > }
> > > >
> > > > ---------------------------------------------------------------------
> > > >-
> >
> > ---
> >
> > > > Using Tomcat but need to do more? Need to support web services,
> >
> > security?
> >
> > > > Get stuff done quickly with pre-integrated technology to make your
> > > > job easier.
> > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > > > Geronimo
> > > > http://sel.as-
> >
> > us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >
> > > > _______________________________________________
> > > > Bacula-users mailing list
> > > > Bacula-users@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/bacula-users
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Bacula-users mailing list
> > Bacula-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/bacula-users

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to