diff -u backuppc-3.3.0/debian/changelog backuppc-3.3.0/debian/changelog --- backuppc-3.3.0/debian/changelog +++ backuppc-3.3.0/debian/changelog @@ -1,3 +1,11 @@ +backuppc (3.3.0-1ubuntu1.1) trusty; urgency=medium + + * d/rules, d/p/smb-compat-fix.patch: cope with changes in newer smbclient. + Thanks to Maksym Schipka (LP: #1576187) + * d/t/{control,smb-backup}: simple smb-based DEP8 test (LP: #1677755) + + -- Andreas Hasenack Tue, 23 Oct 2018 09:06:27 -0300 + backuppc (3.3.0-1ubuntu1) trusty-proposed; urgency=low * Merge from Debian unstable. Remaining changes: (LP: #1201029) diff -u backuppc-3.3.0/debian/rules backuppc-3.3.0/debian/rules --- backuppc-3.3.0/debian/rules +++ backuppc-3.3.0/debian/rules @@ -75,6 +75,7 @@ patch --no-backup-if-mismatch -p0 < debian/patches/config.pl.diff install --mode=644 debian/backuppc/etc/backuppc/config.pl debian/backuppc/usr/share/backuppc/conf rm -rf debian/backuppc/etc/backuppc/config.pl + patch --no-backup-if-mismatch -p0 < debian/patches/smb-compat-fix.patch # Build architecture-independent files here. binary-indep: build install only in patch2: unchanged: --- backuppc-3.3.0.orig/debian/patches/smb-compat-fix.patch +++ backuppc-3.3.0/debian/patches/smb-compat-fix.patch @@ -0,0 +1,66 @@ +From d7a8403b537ed0068e862abc20065e98209527b7 Mon Sep 17 00:00:00 2001 +From: Maksym Schipka +Date: Sun, 14 Aug 2016 09:24:52 +0100 +Subject: [PATCH] Fixing compatibility with Samba 4.3 +Origin: https://github.com/backuppc/backuppc/commit/c550528be63c3b66744830e992b908fff3f2e271 +Bug: https://github.com/backuppc/backuppc/issues/21 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/backuppc/+bug/1576187 +Bug-Debian: https://bugzilla.samba.org/show_bug.cgi?id=11642 +Last-Update: 2018-10-16 + +--- + bin/BackupPC_dump | 2 ++ + lib/BackupPC/Xfer/Smb.pm | 13 ++++++++++++- + 2 files changed, 14 insertions(+), 1 deletion(-) +diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump +index 9491046..e41cb68 100755 +--- debian/backuppc/usr/share/backuppc/bin/BackupPC_dump ++++ debian/backuppc/usr/share/backuppc/bin/BackupPC_dump +@@ -873,6 +873,8 @@ for my $shareName ( @$ShareNames ) { + # Merge the xfer status (need to accumulate counts) + # + my $newStat = $xfer->getStats; ++ # MAKSYM 14082016: forcing the right file count if some bytes were transferred; ensures compatibility with at least Samba-4.3 ++ $newStat->{fileCnt} = $nFilesTotal if ( $useTar && $newStat->{fileCnt} == 0 && $xfer->getStats->{byteCnt} > 0 ); + if ( $newStat->{fileCnt} == 0 ) { + $noFilesErr ||= "No files dumped for share $shareName"; + } +diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm +index eaf002e..48964cb 100644 +--- debian/backuppc/usr/share/backuppc/lib/BackupPC/Xfer/Smb.pm ++++ debian/backuppc/usr/share/backuppc/lib/BackupPC/Xfer/Smb.pm +@@ -217,6 +217,8 @@ sub readOutput + # This section is highly dependent on the version of smbclient. + # If you upgrade Samba, make sure that these regexp are still valid. + # ++ # MAKSYM 14082016: The next regex will never match on Samba-4.3, as ++ # smbclient doesn't produce output required; keeping it for older Sambas + if ( /^\s*(-?\d+) \(\s*\d+[.,]\d kb\/s\) (.*)$/ ) { + my $sambaFileSize = $1; + my $pcFileName = $2; +@@ -230,8 +232,15 @@ sub readOutput + $t->{byteCnt} += $2; + $t->{fileCnt}++; + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 ); +- } elsif ( /^\s*tar: dumped \d+ files/ ) { ++ } elsif ( /^\s*tar: dumped (\d+) files/) { ++ # MAKSYM 14082016: Updating file count to the likely number + $t->{xferOK} = 1; ++ $t->{fileCnt} = $1; ++ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); ++ } elsif ( /^\s*tar:\d+\s*Total bytes received: (\d+)/) { ++ # MAKSYM 14082016: Updating byte count to the likely number ++ $t->{xferOK} = 1; ++ $t->{byteCnt} = $1; + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); + } elsif ( /^\s*tar: restored \d+ files/ ) { + $t->{xferOK} = 1; +@@ -270,6 +279,8 @@ sub readOutput + } elsif ( /^\s*directory \\/i ) { + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 ); + } elsif ( /smb: \\>/ ++ || /^\s*tar:\d+/ # MAKSYM 14082016: ignoring 2 more Samba-4.3 specific lines ++ || /^\s*WARNING:/i + || /^\s*added interface/i + || /^\s*tarmode is now/i + || /^\s*Total bytes written/i only in patch2: unchanged: --- backuppc-3.3.0.orig/debian/tests/control +++ backuppc-3.3.0/debian/tests/control @@ -0,0 +1,3 @@ +Tests: smb-backup +Depends: @, samba, smbclient +Restrictions: isolation-container, allow-stderr, needs-root only in patch2: unchanged: --- backuppc-3.3.0.orig/debian/tests/smb-backup +++ backuppc-3.3.0/debian/tests/smb-backup @@ -0,0 +1,89 @@ +#!/bin/sh + +set -ex + +check_status() { + local status_code=$1 + local msg="${2:-task}" + + if [ "$status_code" -ne "0" ]; then + echo "ERROR: $msg failed, exit status was $status_code" + exit "$status_code" + else + echo "OK: $msg succeeded" + fi +} + +populate_directory() { + local target="$1" + local tempfile + + # target must exist and be a directory + test -d "$target" || exit 1 + + for n in $(seq 1 10); do + tempfile=$(mktemp "$target/tmp.XXXXXX") + # the date command makes each tempfile different + # the seq command just produces a lot of output + # using a "here" document as to not pollute the set -x + # output with large command lines + cat > "$tempfile" <&1 | grep -qE "^\[public\]"; then + echo "Adding [public] share" + cat >> /etc/samba/smb.conf < /etc/backuppc/localhost.pl <