Bug 1669891
| Summary: | python plugin incorrect initialization of built in "nbdkit" module | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Community] Virtualization Tools | Reporter: | Hubert Kario <hkario> | ||||
| Component: | nbdkit | Assignee: | Richard W.M. Jones <rjones> | ||||
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | urgent | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | unspecified | CC: | hkario, ptoscano, rjones, tburke | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | |||||||
| : | 1670052 1670053 (view as bug list) | Environment: | |||||
| Last Closed: | 2019-01-28 13:41:20 UTC | Type: | Bug | ||||
| 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: | 1670052, 1670053 | ||||||
| Attachments: |
|
||||||
Yes that should as far as I know work. Let me play around here and see if I can reproduce it. So that *does* work over here. Can you let me have the full output from your ./configure command? I should say that what's supposed to be happening here is when we load the Python module it defines an internal nbdkit module and then loads the script into the same interpreter, so the script should see the nbdkit module: https://github.com/libguestfs/nbdkit/blob/7b2b9231eaf3a5614ec329eda103cb74e875f489/plugins/python/python.c#L223-L246 > What does work make check passes the example1 plugin from readme runs (I didn't try connecting to it though) > nbdkit module and then > loads the script into the same interpreter, so the script should > see the nbdkit module yes, that's my understanding, but it doesn't look like it is happening - maybe some compatibility issue with Python 3.7 (it's python 3.7.2)? Created attachment 1524192 [details]
./configure output
output from ./configure run as specified above
Thanks for the configure output. The important lines are: checking for python... /usr/bin/python3 checking version of /usr/bin/python3... 3.7 checking for PYTHON... yes checking for PyString_FromString in -lc... no checking for PyString_AsString in -lc... no checking for PyUnicode_AsUTF8 in -lc... yes and these are identical to what is displayed on my test system (Fedora 29, python3-3.7.2-1.fc29.x86_64) The example1 plugin is written in C so I wouldn't expect that to be affected by this bug. Note that the C part of the Python plugin is loaded correctly. It's when it loads the Python script that things start to go wrong. I am surprised however that ‘make check’ is not affected. There is a Python test: PASS: test-python You might want to verify that this was "PASS" (not "SKIP"). OK I *have* managed to reproduce this with python3-3.7.2-4.fc30.x86_64. How strange ... I don't see `test-python.sh` in the `make check` output, only `test-python-exception.sh` and `test-shebang-python.sh` and both PASS: PASS: test-help.sh PASS: test-version.sh PASS: test-dump-config.sh PASS: test-help-plugin.sh PASS: test-version-plugin.sh PASS: test-version-filter.sh PASS: test-dump-plugin.sh PASS: test-start.sh SKIP: test-single.sh PASS: test-single-from-file.sh PASS: test-captive.sh PASS: test-random-sock.sh SKIP: test-tls.sh SKIP: test-tls-psk.sh SKIP: test-ip.sh PASS: test-socket-activation PASS: test-foreground.sh PASS: test-debug-flags.sh PASS: test-ansi-c.sh PASS: test-cxx.sh PASS: test-exit-with-parent SKIP: test-parallel-file.sh SKIP: test-parallel-nbd.sh PASS: test-eflags.sh SKIP: test-data-7E.sh SKIP: test-data-base64.sh SKIP: test-data-file.sh SKIP: test-data-raw.sh SKIP: test-full.sh SKIP: test-memory-largest.sh SKIP: test-memory-largest-for-qemu.sh SKIP: test-partitioning1.sh SKIP: test-partitioning4.sh SKIP: test-partitioning6.sh SKIP: test-pattern.sh SKIP: test-pattern-largest.sh SKIP: test-pattern-largest-for-qemu.sh PASS: test-vddk.sh SKIP: test-zero.sh PASS: test-dump-plugin-example4.sh PASS: test-shebang-perl.sh PASS: test-python-exception.sh PASS: test-shebang-python.sh PASS: test-layers.sh PASS: test-layers SKIP: test-blocksize.sh SKIP: test-cache-max-size.sh SKIP: test-error0.sh SKIP: test-error10.sh SKIP: test-error100.sh SKIP: test-fua.sh SKIP: test-log.sh SKIP: test-nozero.sh SKIP: test-offset2.sh SKIP: test-partition1.sh SKIP: test-truncate1.sh SKIP: test-truncate2.sh SKIP: test-truncate3.sh ============================================================================ Testsuite summary for nbdkit 1.11.2 ============================================================================ # TOTAL: 58 # PASS: 25 # SKIP: 33 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ Thanks for the bug report. This was a real bug in the nbdkit python module (all the way back to Python 2) which was only revealed by a recent change in Python 3. https://github.com/libguestfs/nbdkit/commit/6e756abe3db120f67bd789e3eb2f5a0449b8dab1 https://github.com/libguestfs/nbdkit/commit/308092dfaf191e9ef59eeaa3db81f3b65a3bb31f Fixed in nbdkit >= 1.11.3 & >= 1.10.2 |
Description of problem: I've tried to build and run nbdkit with the python plugin, but the example crashes with ModuleNotFoundError: No module named 'nbdkit' Version-Release number of selected component (if applicable): master (1.11.2) 7b2b9231eaf3 on Archlinux How reproducible: always Steps to Reproduce: 1. autoreconf -i 2. ./configure --prefix=/usr --sbindir=/usr/bin PYTHON=/usr/bin/python3 3. make 4. ./nbdkit -f -v python ./plugins/python/example.py test1=foo test2=bar Actual results: /home/tomato/workspace/nbdkit/server/nbdkit -f -v -- /home/tomato/workspace/nbdkit/plugins/python/.libs/nbdkit-python-plugin.so ./plugins/python/example.py test1=foo test2=bar nbdkit: debug: TLS disabled: could not load TLS certificates nbdkit: debug: registering plugin /home/tomato/workspace/nbdkit/plugins/python/.libs/nbdkit-python-plugin.so nbdkit: debug: registered plugin /home/tomato/workspace/nbdkit/plugins/python/.libs/nbdkit-python-plugin.so (name python) nbdkit: debug: python: load nbdkit: debug: python: config key=script, value=./plugins/python/example.py Traceback (most recent call last): File "./plugins/python/example.py", line 26, in <module> import nbdkit ModuleNotFoundError: No module named 'nbdkit' nbdkit: error: ./plugins/python/example.py: error running this script Expected results: nbd server started, uses python example script Additional info: I did try to package and install it, but it fails with the same error message