apt-offline crashes because of python currentThread() is deprecated

Bug #1977972 reported by JPT
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt-offline (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,

apt-offline crashes from deprecation warning!?

apt-offline 1.8.4-1
python 3.10.4-0ubuntu2
Linux 5.15.0-30-generic
Ubtuntu jammy

$ apt-offline get --bundle upgrade.zip upgrade.sig

Fetching APT Data
Downloading apache2 - 95 KiB
apache2 done
Exception in thread Thread-1 (run):#############] 100.0% of 95 KiB
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineLib.py", line 691, in run
    if threading.currentThread().guiTerminateSignal:
  File "/usr/lib/python3.10/threading.py", line 1442, in currentThread
    warnings.warn('currentThread() is deprecated, use current_thread() instead',
DeprecationWarning: currentThread() is deprecated, use current_thread() instead

btw, if apt-offline does security updates, it adds a comment at the top which makes "apt-offline get" crash.

thanks

Revision history for this message
JPT (j-p-t) wrote :

replacing
currentThread().getName()
with
threading.current_thread().name
in
AptOfflineCoreLib.py
AptOfflineLib.py
acutally solves the problem

Revision history for this message
Alberto Contreras (aciba) wrote :

Reproduced with:

```sh
$ lxc launch ubuntu-daily:jammy dev-j
$ lxc exec dev-j -- sh -c 'apt update && apt install -y apt-offline'
$ lxc exec dev-j -- apt-offline set gcc-offline.sig --install-packages gcc
$ lxc exec dev-j -- apt-offline get gcc-offline.sig --bundle gcc-install.zip

Fetching APT Data

Downloading gcc-11-base - 20 KiB
gcc-11-base done
Exception in thread Thread-1 (run):#############] 100.0% of 20 KiB
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineLib.py", line 691, in run
    if threading.currentThread().guiTerminateSignal:
  File "/usr/lib/python3.10/threading.py", line 1442, in currentThread
    warnings.warn('currentThread() is deprecated, use current_thread() instead',
DeprecationWarning: currentThread() is deprecated, use current_thread() instead

Downloaded data to /root/gcc-install.zip

$ lxc exec dev-j -- echo $?
0
$ lxc exec dev-j -- apt-offline install gcc-install.zip
Proceeding with installation
gcc-11-base_11.2.0-19ubuntu1_amd64.deb file synced.
$ lxc exec dev-j -- echo $?
0
```

The program does not crash, but prints to stdout a traceback which makes the user think there is an error.

Revision history for this message
Alberto Contreras (aciba) wrote :

Upstream has fixed this their main branch: https://github.com/rickysarraf/apt-offline/commit/9dff4ed97d8a7feb88714e59c4a477e7b98a11bb

A new release is planned, and deb packages will be updated: https://github.com/rickysarraf/apt-offline/issues/191

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.