On 2009-06-13 13:08 +0200, Alexey Salmin wrote:

> Package: backup-manager
> Version: 0.7.8-1
> Severity: normal
> Tags: patch
>
> Hello! I'm using backup manager with BM_TARBALL_FILETYPE="tar.gz".
> File changes during the backup are recognized as errors despite the
> fact that tar return code is "1". This is caused by the bug in
> backup-methods.sh: BM__CURRENT_COMMAND variable isn't set properly.
> I've made a small patch. I'm not sure how to fix that correctly but
> I've tried :) May be it's a good idea to set BM__CURRENT_COMMAND
> variable in function __get_backup_tarball_command() but it still
> will not work for encrypted archives.

Anyway, your patch seems to work for unencrypted archives at least, so
I'm going to apply it for the next Debian version.

> Actually the way backup-manager executes commands doesn't allow to
> treat this situation properly: error codes are lost in pipelines.

True; we could try to "set -o pipefail" to alleviate that, but then
there is the problem of distinguishing between tar exiting with return
code 1 which is non-fatal, and the compressor exiting with the same
return code which generally _will_ be fatal.

> May be it's better to pass date through FIFO's and get the error
> codes separately?

Maybe that is an idea.  Alexis?


For the reference, here is the patch against current SVN in unified
format:

Index: lib/backup-methods.sh
===================================================================
--- lib/backup-methods.sh	(revision 592)
+++ lib/backup-methods.sh	(working copy)
@@ -629,7 +629,12 @@
 
         # the common commandline
         *)
-            BM__CURRENT_COMMAND="generic"
+            # tar, tar.gz, tar.bz2, tar.whatever
+            if [[ "${BM_TARBALL_FILETYPE:0:3}" == "tar" ]] ; then
+                BM__CURRENT_COMMAND="tar"
+            else
+                BM__CURRENT_COMMAND="generic"
+            fi
             debug "$command $file_to_create \"$target\" > $logfile 2>&1"
             tail_logfile "$logfile"
             debug "$command $file_to_create \"$target\""

Reply via email to