Bug#966566: backup-manager: FTPS purges and uploads fail

2021-01-26 Thread Pierre-Elliott Bécue
Le jeudi 30 juillet 2020 à 21:11:38+0200, Bachsau a écrit :
> Package: backup-manager
> Version: 0.7.14-1+deb10u1
> Severity: important
> Tags: patch
> 
> Dear Maintainer,
> 
> backup-manager-upload fails to gather a list of files from the FTP server in 
> order to purge them. The error message from Perl is "Not an ARRAY reference". 
> It also fails to find the archives for uploading because it uses `basename` 
> on the full path without changing its working directory before.
> 
> Both of these errors are caused by serious mistakes in the code, which 
> doesn't seem to have been tested thoroughly after backup-manager was updated 
> to use a new library for uploads.

Dear Maxi,

Due to the bug being a bit old, of important severity, and the upcoming
freeze, I made a patch from Bachsau's work and made a NMU upload to
DELAYED/5.

I also updated the git repository on salsa accordingly, and I attach the
NMU patchset here.

Should you have any issue with this NMU, please do feel free to tell me
to cancel it and I'll do.

If you need some help to maintain backup-manager, don't hesitate to
tell, I'm eager to do a more important release to get lintian happy and
fit the latest release of the Policy.

With best regards,

-- 
Pierre-Elliott Bécue
GPG: 9AE0 4D98 6400 E3B6 7528  F493 0D44 2664 1949 74E2
It's far easier to fight for one's principles than to live up to them.
From 0c7a470e88d879ee0fd664284925f21c2452db76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= 
Date: Wed, 27 Jan 2021 01:08:03 +0100
Subject: [PATCH] Add new patch:
 0007-Fixes-two-coding-bugs-in-backup-manager-upload

Thanks to Bachsau for reporting (Closes: #966566)
---
 debian/changelog  |  8 
 ...coding-bugs-in-backup-manager-upload.patch | 44 +++
 debian/patches/series |  1 +
 3 files changed, 53 insertions(+)
 create mode 100644 debian/patches/0007-Fixes-two-coding-bugs-in-backup-manager-upload.patch

diff --git a/debian/changelog b/debian/changelog
index 770207d..73a7b72 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+backup-manager (0.7.14-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add new patch: 0007-Fixes-two-coding-bugs-in-backup-manager-upload
+Thanks to Bachsau for reporting (Closes: #966566)
+
+ -- Pierre-Elliott Bécue   Wed, 27 Jan 2021 01:07:50 +0100
+
 backup-manager (0.7.14-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --git a/debian/patches/0007-Fixes-two-coding-bugs-in-backup-manager-upload.patch b/debian/patches/0007-Fixes-two-coding-bugs-in-backup-manager-upload.patch
new file mode 100644
index 000..006a70d
--- /dev/null
+++ b/debian/patches/0007-Fixes-two-coding-bugs-in-backup-manager-upload.patch
@@ -0,0 +1,44 @@
+From: Bachsau 
+Date: Wed, 27 Jan 2021 01:05:07 +0100
+Subject: Fixes two coding bugs in backup-manager-upload
+
+backup-manager-upload fails to gather a list of files from the FTP
+server in order to purge them. The error message from Perl is "Not an
+ARRAY reference". It also fails to find the archives for uploading
+because it uses `basename` on the full path without changing its working
+directory before.
+
+This patch fixes these two bugs
+---
+ backup-manager-upload | 11 ++-
+ 1 file changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/backup-manager-upload b/backup-manager-upload
+index d159eae..1366f60 100755
+--- a/backup-manager-upload
 b/backup-manager-upload
+@@ -526,13 +526,7 @@ sub ftp_clean_directory($)
+ # First, create the list of existing archives
+ my ($fh, $filename) = get_tempfile('ftp-archives-XX');
+ my $BM_UPLOAD_FTP_SECURE = $ENV{"BM_UPLOAD_FTP_SECURE"};
+-my $ra_files;
+-if ($BM_UPLOAD_FTP_SECURE eq "true") {
+-$ra_files = $ftp->list();
+-}
+-else {
+-$ra_files = $ftp->ls();
+-}
++my $ra_files = $ftp->ls();
+ foreach my $file (@$ra_files) {
+ print $fh "$file\n";
+ }
+@@ -812,8 +806,7 @@ sub ftp_put_file ($$)
+ sub ftptls_put_file ($$)
+ {
+ my ($ftp, $file) = @_;
+-my $basename = basename ($file);
+-return $ftp->put ($basename, $file);
++return $ftp->put ($file);
+ }
+ 
+ # }}}
diff --git a/debian/patches/series b/debian/patches/series
index cec10e4..4ee0ee7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ debian-user-guide-location.patch
 fix-tar-errors.patch
 fix-sanitize-messages.patch
 fix-purging-of-remote-archives-via-ftp-or-ssh.patch
+0007-Fixes-two-coding-bugs-in-backup-manager-upload.patch
-- 
2.29.2



signature.asc
Description: PGP signature


Bug#966566: backup-manager: FTPS purges and uploads fail

2020-07-30 Thread Bachsau
Package: backup-manager
Version: 0.7.14-1+deb10u1
Severity: important
Tags: patch

Dear Maintainer,

backup-manager-upload fails to gather a list of files from the FTP server in 
order to purge them. The error message from Perl is "Not an ARRAY reference". 
It also fails to find the archives for uploading because it uses `basename` on 
the full path without changing its working directory before.

Both of these errors are caused by serious mistakes in the code, which doesn't 
seem to have been tested thoroughly after backup-manager was updated to use a 
new library for uploads.


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

Kernel: Linux 4.19.0-9-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE:de:en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages backup-manager depends on:
ii  debconf [debconf-2.0]  1.5.71
ii  perl   5.28.1-6
ii  ucf3.0038+nmu1

backup-manager recommends no packages.

Versions of packages backup-manager suggests:
pn  anacron
pn  backup-manager-doc 
pn  dar
pn  dvd+rw-tools   
pn  genisoimage
ii  gettext-base   0.19.8.1-9
pn  libnet-amazon-s3-perl  
ii  openssh-client 1:7.9p1-10+deb10u2
pn  wodim  
pn  zip

-- debconf information:
* backup-manager/upload-passwd: (password omitted)
* backup-manager/backup-repository: /var/backups/archives
* backup-manager/burning-device:
  backup-manager/upload-key:
* backup-manager/upload-hosts: (redacted)
* backup-manager/upload-user-ftp: (redacted)
* backup-manager/name-format: long
* backup-manager/burning-maxsize:
  backup-manager/upload-user-scp:
* backup-manager/time-to-live: 0
* backup-manager/dump_symlinks: false
* backup-manager/repo_user: root
  backup-manager/cron_d_remove_deprecated: false
* backup-manager/filetype: tar.bz2
* backup-manager/burning-enabled: false
* backup-manager/upload-dir: /
  backup-manager/encryption_recipient:
* backup-manager/transfert_mode: ftp
* backup-manager/burning-method:
* backup-manager/enable_encryption: false
* backup-manager/blacklist: /var/backups/archives /var/lib/mysql
* backup-manager/cron_frequency: daily
* backup-manager/want_to_upload: true
* backup-manager/directories: /etc /home /usr/local /var/backups 
/var/cache/debconf /var/lib /var/log /var/mail /var/tls /var/www
* backup-manager/repo_group: root

-- debsums errors found:
debsums: changed file /usr/bin/backup-manager-upload (from backup-manager 
package)
--- backup-manager-upload.orig  2019-07-29 22:13:50.0 +0200
+++ backup-manager-upload   2020-07-30 19:53:26.130268817 +0200
@@ -526,13 +526,7 @@
 # First, create the list of existing archives
 my ($fh, $filename) = get_tempfile('ftp-archives-XX');
 my $BM_UPLOAD_FTP_SECURE = $ENV{"BM_UPLOAD_FTP_SECURE"};
-my $ra_files;
-if ($BM_UPLOAD_FTP_SECURE eq "true") {
-$ra_files = $ftp->list();
-}
-else {
-$ra_files = $ftp->ls();
-}
+my $ra_files = $ftp->ls();
 foreach my $file (@$ra_files) {
 print $fh "$file\n";
 }
@@ -812,8 +806,7 @@
 sub ftptls_put_file ($$)
 {
 my ($ftp, $file) = @_;
-my $basename = basename ($file);
-return $ftp->put ($basename, $file);
+return $ftp->put ($file);
 }
 
 # }}}