Package: backuppc
Version: 3.1.0-9
Severity: grave
Tags: squeeze patch

Hi,

The following Debian-specific patch logs errors to standard out instead
of standard error:

+++ backuppc-3.1.0/lib/BackupPC/Lib.pm
 
     from_to($path, "utf8", $need->{charsetLegacy})
                         if ( $need->{charsetLegacy} ne "" );
-    return if ( !opendir(my $fh, $path) );
+#    return if ( !opendir(my $fh, $path) );
+    my ($fh);
+    if ( !opendir($fh, $path) ) {
+       print "log ERROR: opendir ($path) failed\n";

This can cause data corruption (experienced by us in the field) because these
errors may end up inside a generated tarball used for restoring data, hence
breaking said tarball.

Attached patch improves the logging such that it logs to stderr instead, and
also skips the case in which the directory simply doesn't exist, in which
case the error is spurious (thereby also addressing #558431).

Can you please see if this patch can be included in the upcoming stable point
release? I can also build and upload packages for that if you don't have the
time right now.

As for wheezy/sid, this problem does not apply because the entire code block
has been removed in 3.1.0-10:
   * Removed useless logging. Closes: #558431
However, the logging is only useless in the case of ENOENT. In all other cases
it's correct to report an error (e.g.: filesystem corrupt). So I would suggest
to reintroduce the patch / forward it to upstream but then obviously with the
stderr fix and the provision for ENOENT.

Cheers,
Thijs


-- System Information:
Debian Release: 6.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
diff -u backuppc-3.1.0/lib/BackupPC/Lib.pm backuppc-3.1.0/lib/BackupPC/Lib.pm
--- backuppc-3.1.0/lib/BackupPC/Lib.pm
+++ backuppc-3.1.0/lib/BackupPC/Lib.pm
@@ -488,7 +488,8 @@
 #    return if ( !opendir(my $fh, $path) );
     my ($fh);
     if ( !opendir($fh, $path) ) {
-       print "log ERROR: opendir ($path) failed\n";
+       print STDERR "ERROR: opendir ($path) failed: $!\n"
+           unless $!{ENOENT};
        return;
     }
 
diff -u backuppc-3.1.0/debian/changelog backuppc-3.1.0/debian/changelog
--- backuppc-3.1.0/debian/changelog
+++ backuppc-3.1.0/debian/changelog
@@ -1,3 +1,10 @@
+backuppc (3.1.0-9.1) stable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix data corruption in tarballs due to logging to stdout.
+
+ -- Thijs Kinkhorst <th...@debian.org>  Thu, 05 Jan 2012 10:24:29 +0100
+
 backuppc (3.1.0-9) unstable; urgency=low
 
   * chown/chmod only the needed dirs. Closes: #531948

Reply via email to