[Debichem-devel] Bug#1028354: apbs fails with python3.11: "invalid mode rU"

Steve Langasek steve.langasek at canonical.com
Mon Jan 9 22:11:29 GMT 2023


Package: apbs
Version: 3.4.1-4
Severity: grave
Tags: patch
Justification: renders package unusable
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu lunar ubuntu-patch

apbs fails its autopkgtests with python3.11, revealing a bug in the
software, because it uses a mode flag to open() which has been deprecated
since python 3 and is now obsolete in python 3.11:

[...]
--------------------------------------------------------------------------------
Testing input file apbs-mol-parallel.in

Splitting the input file into 4 separate files using the inputgen utility

Test failed: invalid mode: 'rU'
Elapsed time: 0.000597 seconds
--------------------------------------------------------------------------------
[...]

  (https://autopkgtest.ubuntu.com/results/autopkgtest-lunar/lunar/amd64/a/apbs/20221229_092334_1918a@/log.gz)

This is not an autopkgtest regression in Debian because the autopkgtest
itself is also buggy, using bash-specific shell syntax in a file with no
interpreter line that as a result fails under /bin/sh.  (I'm not sure why it
gets farther on Ubuntu's autopkgtest infrastructure.) However, despite not
being detected as an autopkgtest regression, it shows a significant code
defect when run under python3.11 and should be fixed.

Please see the attached patch.

Thanks for considering,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru apbs-3.4.1/debian/patches/open-U-obsolete.patch apbs-3.4.1/debian/patches/open-U-obsolete.patch
--- apbs-3.4.1/debian/patches/open-U-obsolete.patch	1969-12-31 16:00:00.000000000 -0800
+++ apbs-3.4.1/debian/patches/open-U-obsolete.patch	2023-01-09 13:27:36.000000000 -0800
@@ -0,0 +1,21 @@
+Description: Drop obsolete "U" mode passed to open()
+ The "U" mode has been deprecated in python since python3 and has had no
+ effect.  In python 3.11, it is now disallowed.  Drop this mode flag that
+ causes runtime failures.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Update: 2023-01-09
+Forwarded: no
+
+Index: apbs-3.4.1/tools/manip/inputgen.py
+===================================================================
+--- apbs-3.4.1.orig/tools/manip/inputgen.py
++++ apbs-3.4.1/tools/manip/inputgen.py
+@@ -311,7 +311,7 @@
+                        file (string)
+     """
+     nproc = 0
+-    file = open(filename, "rU")
++    file = open(filename, "r")
+     text = ""
+     while 1:
+         line = file.readline()
diff -Nru apbs-3.4.1/debian/patches/series apbs-3.4.1/debian/patches/series
--- apbs-3.4.1/debian/patches/series	2022-06-04 00:58:09.000000000 -0700
+++ apbs-3.4.1/debian/patches/series	2023-01-09 13:26:06.000000000 -0800
@@ -5,3 +5,4 @@
 python3.patch
 cmake.patch
 docs.patch
+open-U-obsolete.patch


More information about the Debichem-devel mailing list