Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1393659 - [rpm-python] rpm._rpms: undefined symbol: spec_Type
Summary: [rpm-python] rpm._rpms: undefined symbol: spec_Type
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1462671
TreeView+ depends on / blocked
 
Reported: 2016-11-10 06:12 UTC by Carl George
Modified: 2017-06-19 08:55 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1462671 (view as bug list)
Environment:
Last Closed: 2017-05-23 09:07:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Use correct source file for rpmsign module (831 bytes, patch)
2017-05-22 14:19 UTC, Carl George
no flags Details | Diff

Description Carl George 2016-11-10 06:12:05 UTC
Description of problem:
rpm.addSign and rpm.delSign are not available in Fedora 24's rpm python modules (py2 or py3) due to an undefined symbol.  The rpm module's __init__.py file attempts to import addSign and delSign from rpm._rpms [1], but is wrapped in a try/except to ignore import errors, which results in the methods just not being available.  For reference, on EL7 those methods are successfully imported and are usable.

Version-Release number of selected component (if applicable):
rpm-4.13.0-0.rc1.27.fc24.x86_64
rpm-python-4.13.0-0.rc1.27.fc24.x86_64
rpm-python3-4.13.0-0.rc1.27.fc24.x86_64

How reproducible:
This can be observed in both py2 and py3 by running the same import as the rpm modules's __init__.py file [1] outside of a try/except block.

Actual results:
# python2 -c 'from rpm._rpms import *'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib64/python2.7/site-packages/rpm/_rpms.so: undefined symbol: spec_Type
# python3 -c 'from rpm._rpms import *'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib64/python3.5/site-packages/rpm/_rpms.cpython-35m-x86_64-linux-gnu.so: undefined symbol: spec_Type

Expected results:
# python2 -c 'from rpm._rpms import *'
(successfully imported, no output)

Additional info:
[1]: https://github.com/rpm-software-management/rpm/blob/rpm-4.13.0-rc1/python/rpm/__init__.py#L55-L59

Comment 1 Igor Gnatenko 2016-11-10 06:52:59 UTC
Confirm this bug on rawhide.

Comment 2 Panu Matilainen 2016-11-10 10:14:38 UTC
Yup, fixed upstream for some time, 4.13.1 material certainly:
https://github.com/rpm-software-management/rpm/commit/eb632e5158fa4ef993b0e5df2a354f0be7a7a71d

Comment 3 Carl George 2016-11-10 15:20:08 UTC
That is odd, because that typo exists on EL7 as well, but everything works fine there.

# yumdownloader --source rpm
# rpm -i rpm-4.11.3-21.el7.src.rpm
# cd rpmbuild/SOURCES
# tar -xf rpm-4.11.3.tar.bz2
# grep -A6 rpm\._rpms rpm-4.11.3/python/setup.py.in
rpmsign_mod = Extension('rpm._rpms',
                   sources = ['rpmbmodule.c'],
                   include_dirs = pkgconfig('--cflags'),
                   libraries = pkgconfig('--libs') + ['rpmsign'],
                   extra_compile_args = cflags,
                   extra_link_args = additional_link_args
                  )
# rpm -q rpm
rpm-4.11.3-21.el7.x86_64
# python -c 'from rpm._rpms import *'
#

Comment 4 Igor Gnatenko 2016-11-10 16:26:47 UTC
(In reply to Panu Matilainen from comment #2)
> Yup, fixed upstream for some time, 4.13.1 material certainly:
> https://github.com/rpm-software-management/rpm/commit/
> eb632e5158fa4ef993b0e5df2a354f0be7a7a71d
I think it's different thing.

Comment 5 Panu Matilainen 2016-11-11 07:15:12 UTC
In EL7 setup.py is not used for compiling the shipped python bindings.

It *could* be something else too but I don't see what that would be.

Comment 6 Carl George 2016-12-01 18:34:56 UTC
Can https://github.com/rpm-software-management/rpm/commit/eb632e5158fa4ef993b0e5df2a354f0be7a7a71d be backported as a patch for Fedora 24 and/or 25?

Comment 7 Carl George 2017-01-23 20:52:13 UTC
I'm currently using rpm.addSign with Python 2 on EL7, but I would like to migrate to Python 3 on Fedora.  This bug is preventing me from doing so.  Can anyone comment on whether 4.13.1 is due to be released soon, or if that fix can be backported to Fedora 25?

Comment 8 Carl George 2017-04-14 16:04:49 UTC
This is broken in all current Fedora releases.  Please backport that commit in order to fix it.

Comment 9 Vendula Poncova 2017-05-19 12:58:30 UTC
We get a similar error on Fedora Rawhide when we run pylint:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/astroid/manager.py", line 129, in ast_from_module_name
    module = modutils.load_module_from_name(modname)
  File "/usr/lib/python3.6/site-packages/astroid/modutils.py", line 190, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/usr/lib/python3.6/site-packages/astroid/modutils.py", line 233, in load_module_from_modpath
    module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
  File "/usr/lib64/python3.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib64/python3.6/imp.py", line 342, in load_dynamic
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 560, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
ImportError: /usr/lib64/python3.6/site-packages/rpm/_rpms.cpython-36m-x86_64-linux-gnu.so: undefined symbol: spec_Type

Comment 10 Carl George 2017-05-22 14:17:52 UTC
I tested out adding https://github.com/rpm-software-management/rpm/commit/eb632e5158fa4ef993b0e5df2a354f0be7a7a71d as a patch in COPR https://copr.fedorainfracloud.org/coprs/carlgeorge/rpm-rhbz1393659/ for Fedora 25.  It worked as expected.  Please add the patch.

Comment 11 Carl George 2017-05-22 14:19:26 UTC
Created attachment 1281076 [details]
Use correct source file for rpmsign module

Comment 12 Vendula Poncova 2017-05-22 16:08:56 UTC
This bug breaks anaconda tests for rawhide, so setting as a test blocker.

Comment 13 Panu Matilainen 2017-05-23 05:44:23 UTC
What on earth is anaconda doing with rpm's signing module?

Comment 14 Panu Matilainen 2017-05-23 09:07:32 UTC
Anyway... fixed in rpm-4.13.0.1-21.fc27

Comment 15 Vendula Poncova 2017-05-23 12:59:25 UTC
In our tests, we run pylint on anaconda and pylint fails to analyse code that imports rpm (see comment 9). Thank you!

Comment 16 Carl George 2017-05-23 13:05:34 UTC
This is broken in F26, F25, and F24 as well.  Can it please be fixed in more than just Rawhide?

Comment 17 Vendula Poncova 2017-06-12 12:56:36 UTC
Hi, this bug now breaks anaconda tests on Fedora 26. Could you please fix it as well?

Comment 18 Vendula Poncova 2017-06-19 08:55:01 UTC
Opened new bug for Fedora 26: https://bugzilla.redhat.com/show_bug.cgi?id=1462671


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