Bug 1222694

Summary: [abrt] python-dnf: comps.py:86:install_or_skip:TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'
Product: [Fedora] Fedora Reporter: Onuralp SEZER <thunderbirdtr>
Component: dnfAssignee: Honza Silhan <jsilhan>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: ben_redhat, bgilbert, b, charithag, cj0nes, daniel, david.a.chaves, geezuslucifer, john.stetter, jsilhan, kai, kwills, l4coa3fnjplr, lantw44, matteo, maxr229, mluscon, notting, peljasz, pnemade, pvn, rholy, tim.lauridsen, tonior, vmukhame, yuriyku
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/16a5c9679c1061a3f2b8dfd087c64e2fc755f4bb
Whiteboard: abrt_hash:ab3a0af23a75210aab9dcf295987b6a6071ab7b3
Fixed In Version: dnf-1.0.1-2.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-21 00:16:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description Onuralp SEZER 2015-05-18 20:32:18 UTC
Description of problem:
I was using dnf migrate tool for yum db files and It's crashed when I used. 

Version-Release number of selected component:
python-dnf-1.0.0-1.fc22

Additional info:
reporter:       libreport-2.5.1
cmdline:        /usr/bin/python -OO /usr/bin/dnf-2 migrate
dso_list:       python-dnf-plugins-extras-migrate-0.0.7-1.fc22.noarch
executable:     /usr/bin/dnf-2
kernel:         4.0.3-300.fc22.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
comps.py:86:install_or_skip:TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'

Traceback (most recent call last):
  File "/usr/bin/dnf-2", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 185, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1077, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 126, in run
    self.migrate_groups()
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 247, in migrate_groups
    group_cmd._mark_install(installed)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/group.py", line 240, in _mark_install
    dnf.comps.install_or_skip(solver.group_install, res.groups, types)
  File "/usr/lib/python2.7/site-packages/dnf/comps.py", line 86, in install_or_skip
    count += install_fnc(grp, types, None)
TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'

Local variables in innermost frame:
count: 0
grp_or_env: [<dnf.comps.Group object at 0x7fbb94074f10>]
install_fnc: <bound method Solver.group_install of <dnf.comps.Solver object at 0x7fbb94a1f8d0>>
types: 14
grp: <dnf.comps.Group object at 0x7fbb94074f10>

Comment 1 Onuralp SEZER 2015-05-18 20:32:23 UTC
Created attachment 1026865 [details]
File: backtrace

Comment 2 Onuralp SEZER 2015-05-18 20:32:24 UTC
Created attachment 1026866 [details]
File: environ

Comment 3 Honza Silhan 2015-05-20 10:02:01 UTC
Thanks for the report.

Comment 4 Matteo Settenvini 2015-05-26 11:01:38 UTC
Another user experienced a similar problem:

Trying to run dnf-2 update after updating both dnf and yum to latest version.

reporter:       libreport-2.3.0
cmdline:        /usr/bin/python -OO /usr/bin/dnf-2 migrate --verbose
dso_list:       python-dnf-plugins-extras-migrate-0.0.8-1.fc22.noarch
executable:     /usr/bin/dnf-2
kernel:         3.20.0-0.rc0.git5.1.fc22.x86_64
package:        python-dnf-1.0.0-1.fc22
reason:         comps.py:86:install_or_skip:TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'
runlevel:       N 5
type:           Python
uid:            0

Comment 5 Honza Silhan 2015-05-26 13:22:34 UTC
I need more debug data to see whats going on. Can anyone upload the "/var/log/dnf.log" file just after crash and provide output of `yum group list` and `dnf group list`, please?

Comment 6 Honza Silhan 2015-05-26 13:31:27 UTC
* I need the output of `yum-deprecated group list` actually if you're running on f22+.

Comment 7 Ken Wills 2015-05-26 21:39:05 UTC
I'm seeing the same thing:

# dnf-2 migrate
2108 YUMDB records found, 0 migrated, 2108 skipped/preserved
Migrating groups data...
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.

Traceback (most recent call last):
  File "/bin/dnf-2", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 185, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1077, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 126, in run
    self.migrate_groups()
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 247, in migrate_groups
    group_cmd._mark_install(installed)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/group.py", line 240, in _mark_install
    dnf.comps.install_or_skip(solver.group_install, res.groups, types)
  File "/usr/lib/python2.7/site-packages/dnf/comps.py", line 86, in install_or_skip
    count += install_fnc(grp, types, None)
TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'



# yum-deprecated group list
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.

Loaded plugins: langpacks
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Installed groups:
   Development Tools
   LibreOffice
Available Groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Domain Membership
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   Fedora Eclipse
   FreeIPA Server
   Games and Entertainment
   Headless Management
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   RPM Development Tools
   Robotics
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers
Done

Comment 8 Ting-Wei Lan 2015-05-27 06:30:16 UTC
I also see the same thing:

# cat /var/log/dnf.log
May 27 14:02:41 INFO --- logging initialized ---
May 27 14:02:41 DDEBUG timer: config: 10 ms
May 27 14:02:41 DEBUG cachedir: /var/cache/dnf/x86_64/22

# yum-deprecated group list
Loaded plugins: auto-update-debuginfo, copr, etckeeper, fastestmirror, langpacks, list-data, merge-conf, priorities, ps
Loading mirror speeds from cached hostfile
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Installed groups:
   3D Printing
   Administration Tools
   Authoring and Publishing
   C Development Tools and Libraries
   Cloud Infrastructure
   Design Suite
   Development Tools
   Editors
   Educational Software
   Electronic Lab
   Fedora Eclipse
   LibreOffice
   Milkymist
   Network Servers
   Office/Productivity
   RPM Development Tools
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers
Available Groups:
   Audio Production
   Books and Guides
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Domain Membership
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   MATE Applications
   MATE Compiz
   Medical Applications
   Robotics
Done

# dnf group list
Last metadata expiration check performed 0:00:00 ago on Wed May 27 14:23:43 2015.
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Available groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Development Tools
   Domain Membership
   Fedora Eclipse
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   LibreOffice
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   Robotics
   RPM Development Tools
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers

Comment 9 ben_redhat 2015-05-27 22:19:25 UTC
Same here


# last output of yum2dnf
[...]
2194 YUMDB records found, 26 migrated, 2168 skipped/preserved
Migrating groups data...
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.

Traceback (most recent call last):
  File "/usr/bin/dnf-2", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 185, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1077, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 126, in run
    self.migrate_groups()
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 247, in migrate_groups
    group_cmd._mark_install(installed)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/group.py", line 240, in _mark_install
    dnf.comps.install_or_skip(solver.group_install, res.groups, types)
  File "/usr/lib/python2.7/site-packages/dnf/comps.py", line 86, in install_or_skip
    count += install_fnc(grp, types, None)
TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'



# tail /var/log/dnf.log
May 28 00:05:57 INFO 2194 YUMDB records found, 26 migrated, 2168 skipped/preserved
May 28 00:05:57 INFO Migrating groups data...
May 28 00:06:01 DEBUG_2 Getting group metadata
May 28 00:06:01 DEBUG_2 Adding group file from repository: fedora
May 28 00:06:01 DEBUG_2 Adding group file from repository: updates
May 28 00:06:01 DEBUG_2 timer: loading comps: 210 ms
May 28 00:06:01 DEBUG_2 Cleaning up.



# dnf group list
Last metadata expiration check performed 1:31:15 ago on Wed May 27 22:47:26 2015.
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Available groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Development Tools
   Domain Membership
   Fedora Eclipse
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   LibreOffice
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   Robotics
   RPM Development Tools
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers





# yum-deprecated group list
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.

Loaded plugins: etckeeper, fastestmirror, langpacks, protectbase
Loading mirror speeds from cached hostfile
 * fedora: ftp.halifax.rwth-aachen.de
 * updates: ftp.halifax.rwth-aachen.de
0 packages excluded due to repository protections
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Installed groups:
   LibreOffice
Available Groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Development Tools
   Domain Membership
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   Fedora Eclipse
   FreeIPA Server
   Games and Entertainment
   Headless Management
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   RPM Development Tools
   Robotics
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers
Done

Comment 10 Ken Wills 2015-06-04 19:47:39 UTC
After adding some additional logging to /usr/lib/python2.7/site-packages/dnf/comps.py I can confirm the issue was occuring on my Development Tools group.

I know this isn't right, but changing to this allows the migration to complete:

******** WARNING DON'T USE THIS ***********

+++ /usr/lib/python2.7/site-packages/dnf/comps.py	2015-06-04 14:42:42.829784103 -0500
@@ -84,7 +84,7 @@
     for grp in grp_or_env:
         try:
             count += install_fnc(grp, types, None)
-        except dnf.comps.CompsError as e:
+        except Exception as e:
             logger.warning("%s, %s", str(e)[:-1], _("skipping."))
             grp_or_env.remove(grp)
     return count

I assume catching TypeError here would be inappropriate?

Comment 11 Honza Silhan 2015-06-05 16:50:19 UTC
Thanks to all for the help.
PR: https://github.com/rpm-software-management/dnf/pull/288

Comment 12 Neil 2015-06-07 22:36:33 UTC
Another user experienced a similar problem:

dnf-2 migrate

reporter:       libreport-2.5.1
cmdline:        /usr/bin/python -OO /bin/dnf-2 migrate
dso_list:       python-dnf-plugins-extras-migrate-0.0.8-1.fc22.noarch
event_log:      2015-06-07-17:36:07> ('report_uReport' completado con éxito)
executable:     /bin/dnf-2
kernel:         4.0.4-303.fc22.x86_64
package:        python-dnf-1.0.0-1.fc22
reason:         comps.py:86:install_or_skip:TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'
runlevel:       N 3
type:           Python
uid:            0

Comment 13 Neil 2015-06-07 22:49:23 UTC
[root@infinity duff]# dnf group mark install Cinnamon
Last metadata expiration check performed 0:16:53 ago on Sun Jun  7 17:28:45 2015.
Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 185, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1077, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/group.py", line 379, in run
    return self._mark_install(extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/group.py", line 240, in _mark_install
    dnf.comps.install_or_skip(solver.group_install, res.groups, types)
  File "/usr/lib/python2.7/site-packages/dnf/comps.py", line 86, in install_or_skip
    count += install_fnc(grp, types, None)
TypeError: unsupported operand type(s) for +=: 'int' and 'TransactionBunch'

Comment 14 Benjamin 2015-06-08 04:18:50 UTC
after applying the pull request from #11 manually, both #12 (dnf-2 migrate) and #13 (group mark install) are working fine.

Comment 15 Fedora Update System 2015-06-12 09:05:34 UTC
dnf-1.0.1-2.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/dnf-1.0.1-2.fc22

Comment 16 Fedora Update System 2015-06-14 17:33:31 UTC
Package dnf-1.0.1-2.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-1.0.1-2.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-10004/dnf-1.0.1-2.fc22
then log in and leave karma (feedback).

Comment 17 Honza Silhan 2015-06-16 09:11:06 UTC
*** Bug 1225285 has been marked as a duplicate of this bug. ***

Comment 18 Fedora Update System 2015-06-21 00:16:14 UTC
dnf-1.0.1-2.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Honza Silhan 2015-07-24 13:02:59 UTC
*** Bug 1231477 has been marked as a duplicate of this bug. ***