The xdrlib module in Python will be removed in Python 3.13 (likely released late 2024). We use this in tl-mount-localdrives, so we need to find a different solution.
xdrlib is currently only used in two external modules we include:
* pynfs - http://git.linux-nfs.org/?p=bfields/pynfs.git;a=summary
* unfs3 - https://github.com/unfs3/unfs3/tree/master
Unfortunately, these modules still use xdrlib, so we can't just upgrade them. However, if we do any modifications to them, we should consider sharing it with upstream.
Note that unfs3 is used in the client which does not have a Python requirement, so the only module that is of interest for this bug is pynfs.
I looked into alternatives for xdrlib, but did not find any recommendations either from Python or anyone else. It seems that Python is deprecating it because it is niche and mostly for NFS .
Looking at the code for xdrlib , it seems to all be in one file and it only depends on other standard modules. Also, the code has seen very few changes over the last 15 years, so it is a stable module.
One viable solution for this bug is including xdrlib in ThinLinc, since the maintenance of this module seems to be very low.
Another solution is switching out pynfs as a whole to another lib that does not use xdrlib.
In tl-mount-localdrives, we use pynfs to mount the client and connect it to the server, and handle the communication.
I found libnfs-python , which seems to have a similar functionality to pynfs. However, I'm unsure of how it handles packing and unpacking of different types, since I at a brief look couldn't see any special handling for that.
In order to run libnfs-python, the package libnfs  is needed. It seems to be relatively common (I had it installed on my Fedora), but I'm not sure if the different distributions ships it as default. Also, it's not a requirement that a replacement for pynfs is in Python, so libnfs itself could possibly also be an alternative.
libnfs-python uses compiled files to run, and these compiled files are only compatible with one Python version. Since we want to support multiple Python versions, we would have to include one file for each version. This is not a reasonable option, and hence libnfs-python is not a suitable alternative for us.
Since xdrlib seems to have such a low maintainance and only is one file, we have decided to include it in our source tree for now instead of finding another lib to use.
In the future, more people will (probably) have run into the issue of xdrlib being deprecated. If we need to revisit this area later, pynfs might not depend on xdrlib, or at a minimum there should be more posts or discussions about the subject.
Since Fedoras plans for Python 3.12 indicate that it will be included in Fedora 39 , I think we can assume the first Fedora version with Python 3.13 will be Fedora 40 (Q2 2024).
That would likely translate into RHEL 10 (Q2 2025) .
Ubuntu 22.04 shipped with Python 3.10  (which was released a few months prior ). Judging from the past, I would assume Python 3.13 won't be included in the next LTS (24.04), but probably in 24.10 or 25.04 .
As far as SLES goes, I don't think we need to be concerned. SLES 15 ships with Python 3.6 which is old now.
xdrlib is now included in ThinLinc. Tested on Ubuntu 22.04 by first removing xdrlib from pythons standard lib and then checking that I could start up a fresh session and get access to local drives and read and edit files.
Note that unfs3 in our source tree still uses Python's original xdrlib in its imports. As mentioned in comment 2, that part of unfs3 is not used by ThinLinc, so those imports were left as is.
Tips for tester:
- To remove xdrlib from Python, find xdrlib.py and remove it. This should be enough to give you an import error when trying to import it. If you don't get an import error, the file was probably cached (in a .pyc file?) and the cache needs to be removed.
- Only regression testing is needed, I think the bug linked below is a good place for inspiration:
Yes, this works as intended, regression tested on RHEL 9. Local drives work just fine. Tested by removing xdrlib.py as described in comment #14.