Package: subversion-tools
Version: 1.14.0-1
Severity: normal
Tags: patch

There are a couple of bugs in the svn-hot-backup script, probably related to the
upgrade to python 3

See patch below:

--- svn-hot-backup      2020-06-03 19:21:57.000000000 -0700
+++ /usr/bin/svn-hot-backup     2020-07-03 20:28:14.732657020 -0700
@@ -36,6 +36,7 @@
 ######################################################################

 import sys, os, getopt, stat, re, time, shutil, subprocess
+from functools import cmp_to_key

 ######################################################################
 # Global Settings
@@ -219,7 +220,7 @@
     raise Exception("Unable to find the youngest revision for repository '%s'"
                     ": %s" % (repo_dir, stderr_lines[0].rstrip()))

-  return stdout_lines[0].strip()
+  return stdout_lines[0].strip().decode("utf-8")

 ######################################################################
 # Main
@@ -255,7 +256,7 @@
 directory_list = os.listdir(backup_dir)
 young_list = [x for x in directory_list if regexp.search(x)]
 if young_list:
-  young_list.sort(comparator)
+  young_list.sort(key=cmp_to_key(comparator))
   increment = regexp.search(young_list.pop()).groupdict()['increment']
   if increment:
     backup_subdir = os.path.join(backup_dir, repo + "-" + youngest + "-"
@@ -348,7 +349,7 @@
   regexp = re.compile("^" + re.escape(repo) + "-[0-9]+(-[0-9]+)?" + ext_re + 
"$")
   directory_list = os.listdir(backup_dir)
   old_list = [x for x in directory_list if regexp.search(x)]
-  old_list.sort(comparator)
+  old_list.sort(key=cmp_to_key(comparator))
   del old_list[max(0,len(old_list)-num_backups):]
   for item in old_list:
     old_backup_item = os.path.join(backup_dir, item)


-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.7.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages subversion-tools depends on:
ii  libapr1     1.6.5-1+b1
ii  libc6       2.30-8
ii  libsvn1     1.14.0-1
ii  subversion  1.14.0-1

Versions of packages subversion-tools recommends:
ii  exim4-daemon-light [mail-transport-agent]  4.94-4
ii  libconfig-inifiles-perl                    3.000003-1
ii  libsvn-perl                                1.14.0-1
ii  liburi-perl                                1.76-2
ii  rsync                                      3.2.1-1
ii  svn2cl                                     0.14-2

Versions of packages subversion-tools suggests:
pn  ruby-svn  <none>

-- no debconf information

-- debsums errors found:
debsums: changed file /usr/bin/svn-hot-backup (from subversion-tools package)
--- svn-hot-backup      2020-06-03 19:21:57.000000000 -0700
+++ /usr/bin/svn-hot-backup     2020-07-03 20:28:14.732657020 -0700
@@ -36,6 +36,7 @@
 ######################################################################
 
 import sys, os, getopt, stat, re, time, shutil, subprocess
+from functools import cmp_to_key
 
 ######################################################################
 # Global Settings
@@ -219,7 +220,7 @@
     raise Exception("Unable to find the youngest revision for repository '%s'"
                     ": %s" % (repo_dir, stderr_lines[0].rstrip()))
 
-  return stdout_lines[0].strip()
+  return stdout_lines[0].strip().decode("utf-8")
 
 ######################################################################
 # Main
@@ -255,7 +256,7 @@
 directory_list = os.listdir(backup_dir)
 young_list = [x for x in directory_list if regexp.search(x)]
 if young_list:
-  young_list.sort(comparator)
+  young_list.sort(key=cmp_to_key(comparator))
   increment = regexp.search(young_list.pop()).groupdict()['increment']
   if increment:
     backup_subdir = os.path.join(backup_dir, repo + "-" + youngest + "-"
@@ -348,7 +349,7 @@
   regexp = re.compile("^" + re.escape(repo) + "-[0-9]+(-[0-9]+)?" + ext_re + 
"$")
   directory_list = os.listdir(backup_dir)
   old_list = [x for x in directory_list if regexp.search(x)]
-  old_list.sort(comparator)
+  old_list.sort(key=cmp_to_key(comparator))
   del old_list[max(0,len(old_list)-num_backups):]
   for item in old_list:
     old_backup_item = os.path.join(backup_dir, item)

Reply via email to