Package: cracklib2
Followup-For: Bug #1055571
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
Control: tags -1 patch

Dear Maintainer,

When attempting to build src:cracklib2 against Python 3.12, the
build-time test-suite fails, making the package FTBFS.

The test-suite still uses unittest.TestCase.assertEquals() which was
a deprecated alias for unittest.TestCase.assertEqual() (without the s).
The alias was dropped from Python 3.12.

In Ubuntu, the attached patch was applied to achieve the following:


  * Fix build against Python 3.12. (LP: #2045290)


Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers mantic-updates
  APT policy: (500, 'mantic-updates'), (500, 'mantic-security'), (500, 'mantic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-16-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru cracklib2-2.9.6/debian/patches/python3.12-support.patch 
cracklib2-2.9.6/debian/patches/python3.12-support.patch
--- cracklib2-2.9.6/debian/patches/python3.12-support.patch     1970-01-01 
01:00:00.000000000 +0100
+++ cracklib2-2.9.6/debian/patches/python3.12-support.patch     2023-11-30 
17:46:13.000000000 +0100
@@ -0,0 +1,77 @@
+Description: Fix build against Python 3.12
+ The build-time test suite still used the obsolete assertEquals function -
+ which was obsolete and got dropped from Python 3.12. Use the replacement
+ instead so we can build with Python 3.12.
+Author: Olivier Gayot <olivier.ga...@canonical.com>
+Bug-Ubuntu: https://launchpad.net/bugs/2045290
+Bug-Debian: https://bugs.debian.org/1055571
+Forwarded: https://github.com/cracklib/cracklib/pull/75
+Last-Update: 2023-11-30
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/python/test_cracklib.py
++++ b/python/test_cracklib.py
+@@ -76,41 +76,41 @@
+     def test_simple_lower(self):
+         for passwd in ['t' * i for i in range(
+                 cracklib.MIN_LENGTH - cracklib.LOW_CREDIT)]:
+-            self.assertEquals(
++            self.assertEqual(
+                 1, cracklib.simple(passwd),
+                 'password {0} should be detected as too simple'.format(
+                     passwd))
+-        self.assertEquals(0, cracklib.simple(
++        self.assertEqual(0, cracklib.simple(
+             't' * (cracklib.MIN_LENGTH - cracklib.LOW_CREDIT)))
+ 
+     def test_simple_upper(self):
+         for passwd in ['T' * i for i in range(
+                 cracklib.MIN_LENGTH - cracklib.UP_CREDIT)]:
+-            self.assertEquals(
++            self.assertEqual(
+                 1, cracklib.simple(passwd),
+                 'password {0} should be detected as too simple'.format(
+                     passwd))
+-        self.assertEquals(0, cracklib.simple(
++        self.assertEqual(0, cracklib.simple(
+             'T' * (cracklib.MIN_LENGTH - cracklib.UP_CREDIT)))
+ 
+     def test_simple_digit(self):
+         for passwd in ['1' * i for i in range(
+                 cracklib.MIN_LENGTH - cracklib.DIG_CREDIT)]:
+-            self.assertEquals(
++            self.assertEqual(
+                 1, cracklib.simple(passwd),
+                 'password {0} should be detected as too simple'.format(
+                     passwd))
+-        self.assertEquals(0, cracklib.simple(
++        self.assertEqual(0, cracklib.simple(
+             '1' * (cracklib.MIN_LENGTH - cracklib.DIG_CREDIT)))
+ 
+     def test_simple_other(self):
+         for passwd in ['#' * i for i in range(
+                 cracklib.MIN_LENGTH - cracklib.OTH_CREDIT)]:
+-            self.assertEquals(
++            self.assertEqual(
+                 1, cracklib.simple(passwd),
+                 'password {0} should be detected as too simple'.format(
+                     passwd))
+-        self.assertEquals(0, cracklib.simple(
++        self.assertEqual(0, cracklib.simple(
+             '#' * (cracklib.MIN_LENGTH - cracklib.OTH_CREDIT)))
+ 
+     def test_simple_combinations(self):
+@@ -119,11 +119,11 @@
+                 cracklib.MIN_LENGTH -
+                 cracklib.LOW_CREDIT -
+                 cracklib.OTH_CREDIT)]:
+-            self.assertEquals(
++            self.assertEqual(
+                 1, cracklib.simple(passwd),
+                 'password {0} should be detected as too simple'.format(
+                     passwd))
+-        self.assertEquals(0, cracklib.simple(
++        self.assertEqual(0, cracklib.simple(
+             testset[:(cracklib.MIN_LENGTH - cracklib.LOW_CREDIT -
+                       cracklib.OTH_CREDIT)]))
+ 
diff -Nru cracklib2-2.9.6/debian/patches/series 
cracklib2-2.9.6/debian/patches/series
--- cracklib2-2.9.6/debian/patches/series       2022-11-29 08:26:33.000000000 
+0100
+++ cracklib2-2.9.6/debian/patches/series       2023-11-30 17:46:13.000000000 
+0100
@@ -4,3 +4,4 @@
 CVE-2016-6318.patch
 overflow-processing-long-words.patch
 fix-musl-linux-any-build
+python3.12-support.patch

Reply via email to