Bug 1597005 - int(misc.getloginuid()), but getloginuid() can return None (dnf/db/history.py)
Summary: int(misc.getloginuid()), but getloginuid() can return None (dnf/db/history.py)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 29
Hardware: riscv64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-01 12:09 UTC by David Abdurachmanov
Modified: 2019-07-24 15:20 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-24 15:20:48 UTC


Attachments (Terms of Use)

Description David Abdurachmanov 2018-07-01 12:09:42 UTC
Description of problem:

Fedora/RISC-V (riscv64) kernel does not have /proc/self/loginuid thus misc.getloginuid() returns None and then the conversion to int fails. This happens while running appliance-creator to create nightly disk images.

https://github.com/rpm-software-management/dnf/blob/58197bd1207525fd28cc135f88c2b988357daf5d/dnf/db/history.py#L448

[..]
RPMDB altered outside of DNF.
['/']
Traceback (most recent call last):
  File "/usr/bin/appliance-creator", line 173, in <module>
    sys.exit(main())
  File "/usr/bin/appliance-creator", line 151, in main
    creator.install()
  File "/usr/lib/python2.7/site-packages/imgcreate/creator.py", line 726, in install
    dbo.runInstall()
  File "/usr/lib/python2.7/site-packages/imgcreate/dnfinst.py", line 211, in runInstall
    ret = self.do_transaction(TransactionProgress())
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 904, in do_transaction
    self._run_transaction(cb=cb)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 974, in _run_transaction
    tid = self.history.beg(rpmdbv, using_pkgs, [], cmdline)
  File "/usr/lib/python2.7/site-packages/dnf/db/history.py", line 448, in beg
    int(misc.getloginuid())
TypeError: int() argument must be a string or a number, not 'NoneType'
Unmounting directory /var/tmp/imgcreate-eGs3tj/install_root/
Removing compat symlinks
Unmapping /dev/loop0
Losetup remove /dev/loop0
[..]

Version-Release number of selected component (if applicable):

We moved to DNF 3.0.2 and this started to happen. This particular code was added ~5 months ago and landed in DNF 3.

How reproducible:

Boot in Fedora/RISC-V QEMU, e.g.: https://fedorapeople.org/groups/risc-v/disk-images/

[root@hifive ~]# cat /proc/self/loginuid
cat: /proc/self/loginuid: No such file or directory

[root@hifive ~]# python
Python 2.7.15 (default, May  7 2018, 14:37:14) 
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from dnf.yum import misc
>>> a = misc.getloginuid()
>>> type(a)
<type 'NoneType'>
>>> print(a)
None

Comment 1 larchunix 2018-07-03 12:51:32 UTC
Dear DNF developers,

I am the maintainer of DNF package on the ArchLinux User Repository (https://aur.archlinux.org/packages/dnf/).

Since ArchLinux kernel is compiled without audit support, DNF 3 does not work on Arch because of this issue.

This prevents me to push DNF 3 to the AUR until this bug gets fixed. 

Best regards,

Comment 2 Jan Kurik 2018-08-14 09:56:19 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 3 Jaroslav Mracek 2019-06-30 18:57:41 UTC
I create a patch that catch also TypeError: https://github.com/rpm-software-management/dnf/pull/1428. Please any feedback is welcome.

Comment 4 Jaroslav Mracek 2019-07-24 15:20:48 UTC
It looks like that the issue is already fixed in dnf-3.3.0+ by https://github.com/rpm-software-management/dnf/commit/70779df36929b5ccd621941a78c162ae3b8ea7c2


Note You need to log in before you can comment on or make changes to this bug.