Merge ~ahasenack/ubuntu/+source/freeradius:jammy-freeradius-fix-python3-linking-1873923 into ubuntu/+source/freeradius:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Merged at revision: b9c37d97398c41a645f3b4555f3d1f69b14d6560
Proposed branch: ~ahasenack/ubuntu/+source/freeradius:jammy-freeradius-fix-python3-linking-1873923
Merge into: ubuntu/+source/freeradius:ubuntu/devel
Diff against target: 56 lines (+34/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/fix-python-version-parsing.patch (+26/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Utkarsh Gupta (community) Approve
Canonical Server Pending
Review via email: mp+417631@code.launchpad.net

Description of the change

Fix linking of the rlm_python3 module with python3

PPA: https://launchpad.net/~ahasenack/+archive/ubuntu/freeradius-python3

I'm not super proud of this fix, but I figured it was the smallest one we could do at this stage. Running autoreconf makes a lot of other changes, and also produces warnings. It's likely upstream isn't fully ready for autoconf 2.7x. We had to fix other packages in the recent past due to this autoconf version bump, and I don't think we should do it now just days before beta freeze.

Note that this is a configure (and configure.ac) script deep inside the soruce tree, and not the main one at the root.

That being said, the one-liner fix comes exactly from such an autoreconf run.

I grepped the code and the only other place where the python version is parsed like that is in rlm-python, which we don't build:

=== configuring in src/modules/rlm_python (/<<PKGBUILDDIR>>/src/modules/rlm_python)
...
configure: WARNING: silently not building rlm_python.
configure: WARNING: FAILURE: rlm_python requires: python-binary.

Another option I entertained for a while was to export EMBED=--embed in d/rules, which would also accomplish this. But rely on configure being the same going forward, still using that variable or detection mechanism, and we wouldn't notice a breakage again, unless we added a DEP8 test specifically for this.

To test:
apt update
apt install freeradius freeradius-python3 -y
ln -s /etc/freeradius/3.0/mods-available/python3 /etc/freeradius/3.0/mods-enabled/
systemctl stop freeradius
freeradius -Xx 2>&1 | tee output.log

In jammy, freeradius will exit with this:
Thu Mar 24 14:23:46 2022 : Error: /etc/freeradius/3.0/mods-enabled/python3[9]: Failed to link to module 'rlm_python3': /usr/lib/freeradius/rlm_python3.so: undefined symbol: PyTuple_Type

With the fix, it will stay running.

Another quick check is verify the python3 module was linked with python3:
root@j1:~# ldd /usr/lib/freeradius/rlm_python3.so | grep python
root@j1:~#

versus

root@j1:~# ldd /usr/lib/freeradius/rlm_python3.so | grep python
 libpython3.10.so.1.0 => /lib/x86_64-linux-gnu/libpython3.10.so.1.0 (0x00007f15225c3000)

To post a comment you must log in.
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Looks good with one trivial comment.

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, uploaded

$ dput ubuntu ../freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3_source.changes
D: Setting host argument.
Checking signature on .changes
gpg: ../freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3.dsc: done.
  Uploading freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3.debian.tar.xz: done.
  Uploading freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3_source.buildinfo: done.
  Uploading freeradius_3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 79e713c..41187e9 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+freeradius (3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3) jammy; urgency=medium
7+
8+ * d/p/fix-python-version-parsing.patch: fix parsing of python versions
9+ with multiple digits (LP: #1873923)
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Wed, 23 Mar 2022 20:13:55 -0300
12+
13 freeradius (3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu2) jammy; urgency=medium
14
15 * Fix radtest client crash when using mschap auth (LP: #1962046):
16diff --git a/debian/patches/fix-python-version-parsing.patch b/debian/patches/fix-python-version-parsing.patch
17new file mode 100644
18index 0000000..3ea219a
19--- /dev/null
20+++ b/debian/patches/fix-python-version-parsing.patch
21@@ -0,0 +1,26 @@
22+Description: fix python version parsing
23+ The rlm_python3 configure script failed to correctly parse python minor
24+ versions with more than one digit, like 3.10, which it parsed as being just
25+ 3.1.
26+ It's ugly to patch generated files like ./configure directly, but I think it's
27+ the minimal fix we can apply now, instead of regenerating all autoconf scripts,
28+ which would introduce many more changes.
29+ FWIW, this is the change we get when autoreconf is run.
30+Author: Andreas Hasenack <andreas@canonical.com>
31+Bug: https://github.com/FreeRADIUS/freeradius-server/issues/4441
32+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/freeradius/+bug/1873923
33+Last-Update: 2022-03-23
34+
35+diff --git a/src/modules/rlm_python3/configure b/src/modules/rlm_python3/configure
36+index 52bc177d..48139223 100755
37+--- a/src/modules/rlm_python3/configure
38++++ b/src/modules/rlm_python3/configure
39+@@ -2951,7 +2951,7 @@ $as_echo_n "checking for $am_display_PYTHON version... " >&6; }
40+ if ${am_cv_python_version+:} false; then :
41+ $as_echo_n "(cached) " >&6
42+ else
43+- am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`
44++ am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[:2])"`
45+ fi
46+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5
47+ $as_echo "$am_cv_python_version" >&6; }
48diff --git a/debian/patches/series b/debian/patches/series
49index 4b4a67b..ddc5db9 100644
50--- a/debian/patches/series
51+++ b/debian/patches/series
52@@ -8,3 +8,4 @@ mkdirp.diff
53 snakeoil-certs.diff
54 fix-mschap-client-crash-1.patch
55 fix-mschap-client-crash-2.patch
56+fix-python-version-parsing.patch

Subscribers

People subscribed via source and target branches