File: 0007-Fixes-two-coding-bugs-in-backup-manager-upload.patch

package info (click to toggle)
backup-manager 0.7.14-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,644 kB
  • sloc: sh: 4,041; perl: 1,176; makefile: 215
file content (44 lines) | stat: -rw-r--r-- 1,404 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From: Bachsau <dev@bachsau.com>
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-XXXXXX');
     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);
 }
 
 # }}}