Bug 1491137 - py3: modutils.load_module_from_name() does not work
Summary: py3: modutils.load_module_from_name() does not work
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: samba
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-13 07:35 UTC by Standa Laznicka
Modified: 2017-09-29 05:28 UTC (History)
13 users (show)

Fixed In Version: samba-4.7.0-12.fc27
Clone Of:
Environment:
Last Closed: 2017-09-29 05:28:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Samba Project 13030 0 None None None 2017-09-13 10:14:39 UTC

Description Standa Laznicka 2017-09-13 07:35:34 UTC
Description of problem:
`modutils.load_module_from_name()` is unable to load an existing package (samba.dcerpc in this case)

Version-Release number of selected component (if applicable):
python3-samba-4.7.0-0.10.rc5.fc26.x86_64 (see koji)
python3-astroid-1.5.3-1.fc26.noarch

How reproducible:
100%

Steps to Reproduce:
1. python3 -c 'import samba' && echo "yay"
2. python3 -c 'from astroid import modutils; modutils.load_module_from_name("samba.dcerpc")' && echo "yay"

Actual results:
1. "yay" is printed
2. Traceback (most recent call last):
  File "<string>", line 1, in <module>
  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 232, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = imp.find_module(part, path)
  File "/usr/lib64/python3.6/imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'dcerpc'

Expected results:
"yay" being printed in both steps 1. and 2.

Comment 1 Standa Laznicka 2017-09-13 07:43:13 UTC
Added TestBlocker keyword because this is blocking us from adding correct samba dependencies in our project for Fedora 27 (it would break our tests and disallow pushing further fixes).

Comment 2 Standa Laznicka 2017-09-13 08:37:04 UTC
Turns out it's an issue in samba build:

"""
(10:28:47 AM) ab: slaznick: looks like this particular issue is a build issue in samba build. We have
(10:28:49 AM) ab: * installing source4/librpc/rpc/dcerpc.py as /builddir/build/BUILDROOT/samba-4.7.0-0.10.rc5.fc27.x86_64/usr/lib64/python2.7/site-packages/samba/dcerpc/__init__.py
(10:29:13 AM) ab: but we don't have a similar one for 3.6
(10:29:28 AM) ab: in https://kojipkgs.fedoraproject.org//packages/samba/4.7.0/0.10.rc5.fc27/data/logs/x86_64/build.log
(10:29:48 AM) slaznick: ab: ah ha, you're right, there's no such file
(10:30:12 AM) ab: and astroid does this:
(10:30:14 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc/__init__.py", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:15 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc/__init__.pyc", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:17 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.cpython-36m-x86_64-linux-gnu.so", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:18 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.abi3.so", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:20 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.so", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:21 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.py", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:23 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.pyc", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)

(10:30:41 AM) ab: which is also incorrect because .pyc files are in __pycache__/ subdirectory
"""

Comment 3 Alexander Bokovoy 2017-09-29 05:28:47 UTC
Fixed upstream in 4.7.0 and in samba-4.7.0-12.fc27


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