On Mon, 2006-09-04 18:26:47 +0200, Martin Waitz <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 04, 2006 at 10:26:31AM +0200, Jan-Benedict Glaw wrote:
> > One of my backup systems went out of disk space last night. I saw the
> > disk full message, but faubackup exited with return code zero...
> > 
> > This is an excerpt of the log file I was sent:
> > 
> > Rotating backup
> > Will execute: ssh -i /root/.ssh/back2print_backup_key [EMAIL PROTECTED] 
> > faubackup --one-file-system 
> > /mnt/backup/faubackup/staging/backprint/root_mnt_samba 
> > /mnt/backup/faubackup/daily/backprint/root_mnt_samba
> > faubackup-scatter: fwrite ..inodes/0000fe04/00/4c/00/58: No space left on 
> > device
> > Result: 0
> > 
> > The "Result: " line really is the $? value:-/  Both client and server
> > run faubackup-0.5.8.  Any chance to get it fixed to return non-zero
> > exit values after errors?
> 
> I have no clue how this can happen.
> Could you please send me an strace extract of the faubackup command,
> from the failed fwrite to the end?

Easily to be forced:

# mkdir fautest
# cd fautest
# dd if=/dev/zero bs=1M count=50 of=testfilesystem
# mke2fs testfilesystem
# mkdir xx
# mount -t ext2 -o loop testfilesystem xx
# cd xx
# mkdir data fau
# dd if=/dev/urandom bs=1M count=20 of=data/randomfile
# faubackup -y 1  -m 10 -w 10 -d 10 -L data/ fau/
# dd if=/dev/urandom bs=1M count=20 of=data/randomfile
# faubackup -y 1  -m 10 -w 10 -d 10 -L data/ fau/
faubackup-scatter: fwrite ..inodes/00000700/00/00/07/2a: No space left on device
# bixie:~/fautest/xx# echo $?
0
# cd ..
# umount xx
# rm -rf testfilesystem xx


I think I'll save both of us from looking through the strace files
since I think I just found the final reason (Disclaimer: I'm not a
Perl hacker):

--------------------- /usr/sbin/faubackup --------------------------
[...]
open STDIN, "$gather |" or die "fork: $!";
system( $scatter )==0 or exit $?;
close STDIN or exit $?;

exit 0;
---------------End of: /usr/sbin/faubackup --------------------------

$scatter is the one that will fail. It'll call "exit(1)" at the very
end. The return value of system() is then checked for 0 and I guess
we're failing and exit'ing early. Notice that we exit with $?, which
is probably not the exit() value of $scatter, but it's value <<8, as
mentioned in `man perlfunc' in the "system" description. However, when
the wrapping perl script finishes, only the low byte of it's exit()
call is preserved, which is _not_ the $scatter exit value. So I guess
the system() line should read something like:

system ($scatter) == 0 or exit $? >> 8;

(Disclaimer: Again, I'm not a Perl hacker :-)

MfG, JBG

-- 
      Jan-Benedict Glaw      [EMAIL PROTECTED]              +49-172-7608481
 Signature of:                    Don't believe in miracles: Rely on them!
 the second  :

Attachment: signature.asc
Description: Digital signature

Reply via email to