Bug 672043
Summary: | abrt.pth breaks rpmbuild of python | |||
---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Paul Bolle <pebolle> | |
Component: | abrt | Assignee: | Jiri Moskovcak <jmoskovc> | |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | rawhide | CC: | anton, dfediuck, dmalcolm, dvlasenk, iprikryl, jmoskovc, kklic, mnowak, mtoman, npajkovs, psplicha | |
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | abrt-2.0.3-1.fc15 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 672483 (view as bug list) | Environment: | ||
Last Closed: | 2011-06-24 03:24:22 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: | ||||
Bug Depends On: | ||||
Bug Blocks: | 707950 |
Description
Paul Bolle
2011-01-23 13:21:27 UTC
(In reply to comment #0) > Additional info: > 0) Removing the abrt-addon-python package solves this problem. > - abrt-addon-python should depend on python, because it doesn't make sense to install this without python, need to fix this in spec > 1) I don't really understand what's going on here. This seems to be the first > time I ran into a .pth file. I'm guessing that syslog (a built-in module) isn't > yet available in this stage of the python built. - .pth is meant to be run every time python interpreter is run and this seems to me like python is using some bootstrapping to build/install it's files and as you say, the syslog module is not available (In reply to comment #1) > - abrt-addon-python should depend on python, because it doesn't make sense to > install this without python, need to fix this in spec It already does. See: rpm -q --requires abrt-addon-python [...] python(abi) = 2.7 [...] Just to be clear, the issue that I ran into is that if abrt-addon-python is installed (and therefore python is installed too) building python with rpmbuild isn't possible. I spent some time looking at this; I'm seeing it both in rawhide (2.7) and on RHEL6 (2.6) The site.py module looks for ".pth" files in various directories, when it finds a .pth file: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '. abrt-addon-python has this file: /usr/lib/python2.7/site-packages/abrt.pth containing: import abrt_exception_handler It's happening in "make sharedmods", which invokes the freshly-built python binary on the setup.py In particular, the "syslog" module is built as part of this step. Verbosely invoking the freshly-built python with "import site" from within the build directory: ./python -v -c "import site" shows a series of imports, all being done from within the build tree. This is followed by an import of "abrt_exception_handler", which (on RHEL6) goes to # /usr/lib/python2.6/site-packages/abrt_exception_handler.pyc matches /usr/lib/python2.6/site-packages/abrt_exception_handler.py i.e. it uses the installed python packages tree. Looking at sys.path (builddir here was "/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6"): ./python -c "import sys; print sys.path" we get: 'import site' failed; use -v for traceback ['', '/usr/lib64/python26.zip', '/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/Lib', '/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/Lib/plat-linux2', '/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/Lib/lib-tk', '/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/Lib/lib-old', '/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/Modules', '/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/build/lib.linux-x86_64-2.6', '/home/david/.local/lib/python2.6/site-packages', '/usr/lib64/python2.6/site-packages', '/usr/lib64/python2.6/site-packages/gst-0.10', '/usr/lib64/python2.6/site-packages/gtk-2.0', '/usr/lib64/python2.6/site-packages/webkit-1.0', '/usr/lib/python2.6/site-packages'] So it contains the "site-packages" of the installed tree, but not from the builtin packages of the installed tree (and hence the installed Python's "syslog.so" isn't found). I tried adding "-S" to invocations of ./python, to suppress the implicit "import site" during startup, but it still fails, because: Lib/distutils/command/build_ext.py is importing it explicitly: File "/home/david/coding/cvs-dist/python/RHEL-6/Python-2.6.6/Lib/distutils/command/build_ext.py", line 13, in <module> from site import USER_BASE, USER_SITE On my RHEL 6 box: $ find /usr/lib*/python2.6 -name "*.pth" /usr/lib64/python2.6/site-packages/pygst.pth /usr/lib64/python2.6/site-packages/pygtk.pth /usr/lib64/python2.6/site-packages/webkit-1.0.pth /usr/lib/python2.6/site-packages/abrt.pth and only abrt.pth has an "import line; the others merely list package names. sys.exec_prefix and sys.prefix are coming out as "/usr/". They are calculated by Modules/getpath.c:calculate_path if (!(pfound = search_for_prefix(argv0_path, home))) { and: (gdb) p pfound $24 = -1 which is the return value from search_for_prefix to signify that we're in the build directory (as indeed we are). This means that calculate_path() falls back to using: 642 strncpy(prefix, PREFIX, MAXPATHLEN); and this is set up in the Makefile via: Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ -DPREFIX='"$(prefix)"' \ -DEXEC_PREFIX='"$(exec_prefix)"' \ -DVERSION='"$(VERSION)"' \ -DVPATH='"$(VPATH)"' \ -o $@ $(srcdir)/Modules/getpath.c This reflects this comment in getpath.c: * If we're loading relative to the build directory, * return the compiled-in defaults instead. which seems to have been the case since at least this commit from 1997 http://svn.python.org/view?view=rev&revision=7775 So as it stands, Python expects when built from its build location to look in /usr/ for python libs, and executes .pth files found in those locations. ABRT supplies one, and python uses it. I don't think this is cleanly fixable from the Python side. One workaround is to not have the abrt-addon-python package installed when building python (does rpm have a BuildConflicts: specfile tag?) Another may be to move the "import syslog" into the callsites that use it, rather than in module scope. (In reply to comment #3) > One workaround is to not have the abrt-addon-python package installed when > building python (does rpm have a BuildConflicts: specfile tag?) Yes. For example, adding BuildConflicts: abrt-addon-python will result in rpmbuild -bp $SPECS/python.spec error: Failed build dependencies: abrt-addon-python conflicts with python-2.7.1-5.fc15.i686 if abrt-addon-python is installed. (Maybe the error should have been "[...] buildconflicts with [...]", but that's off topic.) or we can just catch this exception in abrt hook.. *** Bug 676661 has been marked as a duplicate of this bug. *** Fixed in git, thanks Dave, for the hints, I moved import syslog from the module scope and it seems to fix that problem even though python fails to build on my machine with error: 2 skips unexpected on linux2: test_tk test_ttk_guionly [1130032 refs] make: *** [test] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.4WULQM (%check) but that's probably not because of ABRT. abrt-2.0.3-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/abrt-2.0.3-1.fc15 Package abrt-2.0.3-1.fc15: * should fix your issue, * was pushed to the Fedora 15 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing abrt-2.0.3-1.fc15' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/abrt-2.0.3-1.fc15 then log in and leave karma (feedback). abrt-2.0.3-1.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report. |