Source: dovecot
Version: 1:2.3.19.1+dfsg1-2
Severity: serious
Tags: patch
Justification: autopkgtest failure

Dear Maintainer,

The autopkgtest for your package fails with python3.11 because the crypt module 
is deprecated:

 autopkgtest [17:21:34]: test testmails: [-----------------------
 /tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
   import crypt
 test_imap (__main__.DovecotBasics.test_imap)
 Test IMAP4 protocol. ... ok
 test_imaps (__main__.DovecotBasics.test_imaps)
 Test IMAP4S protocol. ... ok
 test_pop3 (__main__.DovecotBasics.test_pop3)
 Test POP3 protocol. ... ok
 test_pop3s (__main__.DovecotBasics.test_pop3s)
 Test POP3S protocol. ... ok
 
 ----------------------------------------------------------------------
 Ran 4 tests in 78.337s
 
 OK
 autopkgtest [17:22:53]: test testmails: -----------------------]
 autopkgtest [17:22:53]: test testmails:  - - - - - - - - - - results - - - - - 
- - - - -
 testmails            FAIL stderr: 
/tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
 autopkgtest [17:22:53]: test testmails:  - - - - - - - - - - stderr - - - - - 
- - - - -
 /tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
   import crypt
 autopkgtest [17:22:53]: @@@@@@@@@@@@@@@@@@@@ summary
 doveadm              PASS
 systemd              PASS
 command1             PASS
 testmails            FAIL stderr: 
/tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13

The attached patch resolves the issue by using python3-passlib which has a pure 
Python implemention to fall back on when the crypt module is not available.

Kind Regards,

Bas
>From b02ebc95e735a488c6a71b2f68774dd7332d16ff Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <sebas...@debian.org>
Date: Thu, 12 Jan 2023 08:04:19 +0100
Subject: Don't use deprecated crypt module.

---
 debian/tests/control   | 2 +-
 debian/tests/testmails | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/tests/control b/debian/tests/control
index 106e5d04a..496cfcc0b 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -11,4 +11,4 @@ Restrictions: needs-root, breaks-testbed, allow-stderr
 
 Tests: testmails
 Restrictions: needs-root, breaks-testbed
-Depends: dovecot-imapd, dovecot-pop3d, lsb-release, python3
+Depends: dovecot-imapd, dovecot-pop3d, lsb-release, python3, python3-passlib
diff --git a/debian/tests/testmails b/debian/tests/testmails
index 71ae3caab..3329809b5 100755
--- a/debian/tests/testmails
+++ b/debian/tests/testmails
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import crypt
 import grp
 import imaplib
 import os
@@ -13,6 +12,8 @@ import subprocess
 import sys
 import unittest
 
+from passlib.hash import des_crypt
+
 
 def random_string(length):
     '''Return a random string, consisting of ASCII letters, with given
@@ -57,7 +58,7 @@ class TestUser:
 
         self.salt = random_string(2)
         self.password = random_string(8)
-        self.crypted = crypt.crypt(self.password, self.salt)
+        self.crypted = des_crypt.using(salt=self.salt).hash(self.password)
 
         subprocess.check_call(['useradd', '-p', self.crypted, '-m', login])
 
-- 
2.30.2

Reply via email to