I found the bug. It is with this line

         [ -z "$errors" ] || exit 3

debian package maintainer scripts do not have their environment
sanitized. So if the (root) user has a variable "errors" set in their
environment (for whatever reason, maybe even apt set it) the postinst
will error.

100% reproduction usecase

sudo errors=hi apt install --reinstall python3

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
Need to get 23.0 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu noble-updates/main amd64 python3 
amd64 3.12.3-0ubuntu2 [23.0 kB]
Fetched 23.0 kB in 0s (56.4 kB/s)  
(Reading database ... 601985 files and directories currently installed.)
Preparing to unpack .../python3_3.12.3-0ubuntu2_amd64.deb ...
running python pre-rtupdate hooks for python3.12...
dpkg: error processing archive 
/var/cache/apt/archives/python3_3.12.3-0ubuntu2_amd64.deb (--unpack):
 new python3 package pre-installation script subprocess returned error exit 
status 3
Errors were encountered while processing:
 /var/cache/apt/archives/python3_3.12.3-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


** Changed in: python3-defaults (Ubuntu)
       Status: Incomplete => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2078356

Title:
  python3 preinst failure to run pre-rtupdate hooks

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/2078356/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to