Bug 1287778 - Python PMAPI pmNonOptionsFromList cryptic error message
Python PMAPI pmNonOptionsFromList cryptic error message
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: pcp (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Nathan Scott
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-02 11:24 EST by Marko Myllynen
Modified: 2016-04-06 10:55 EDT (History)
7 users (show)

See Also:
Fixed In Version: pcp-3.10.9-1.fc23 pcp-3.10.9-1.fc22 pcp-3.11.1-1.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-06 10:55:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Marko Myllynen 2015-12-02 11:24:11 EST
Description of problem:
pmNonOptionsFromList() can fail without really telling why:

localhost:~> cat ./test.py
#!/usr/bin/python

from pcp import pmapi
import sys

opts = pmapi.pmOptions()
print opts.pmNonOptionsFromList(sys.argv)
ctx = pmapi.pmContext.fromOptions(opts, sys.argv)
localhost:~> python ./test.py abc  
Traceback (most recent call last):
  File "./test.py", line 7, in <module>
    print opts.pmNonOptionsFromList(sys.argv)
  File "/usr/lib64/python2.7/site-packages/pcp/pmapi.py", line 792, in pmNonOptionsFromList
    return c_api.pmGetNonOptionsFromList(argv)
SystemError: error return without exception set
localhost:~> 

If we create the context before calling pmNonOptionsFromList() then it works as expected. Ideally the above would work also as e.g. in pmrep(1) we need to read non-options which include references to configuration file entries which will then in turn be used in context creation.

Thanks.
Comment 1 Nathan Scott 2015-12-02 20:35:45 EST
Looking at the code, I think the problem is that pmGetOptions must be called before pmGetNonOptions[...] - because it uses optind and hence getopt state from that earlier call.

Because pmrep is using the all-at-once parse-arguments-and-create-context
interface - i.e. .fromOptions() - that cannot happen in the right order by definition.

However, pmrep could just call the pmContext constructor directly - see the fromOptions code around line 1068 of src/python/pcp/pmapi.py for what happens now.

cheers.
Comment 2 Nathan Scott 2015-12-02 21:10:49 EST
That said, "SystemError: error return without exception set" is certainly an indecipherable error message & we can certainly improve that side of things.
Comment 3 Nathan Scott 2015-12-02 23:43:27 EST
Fixed upstream, will be in pcp-3.10.9.
Comment 4 Fedora Update System 2015-12-16 20:54:48 EST
pcp-3.10.9-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-d08245c076
Comment 5 Fedora Update System 2015-12-16 20:55:32 EST
pcp-3.10.9-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-2b40815137
Comment 6 Fedora Update System 2015-12-16 21:18:18 EST
pcp-3.10.9-1.el5 has been submitted as an update to Fedora EPEL 5. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-2ac90519bc
Comment 7 Fedora Update System 2015-12-17 05:26:43 EST
pcp-3.10.9-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-2b40815137
Comment 8 Fedora Update System 2015-12-17 05:27:03 EST
pcp-3.10.9-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-d08245c076
Comment 9 Fedora Update System 2015-12-17 07:49:09 EST
pcp-3.10.9-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update pcp'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-2ac90519bc
Comment 10 Fedora Update System 2016-01-05 16:58:01 EST
pcp-3.10.9-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 11 Fedora Update System 2016-01-05 17:54:37 EST
pcp-3.10.9-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 12 Fedora Update System 2016-02-02 22:56:57 EST
pcp-3.11.0-1.el5 has been submitted as an update to Fedora EPEL 5. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-57b7efb2d7
Comment 13 Fedora Update System 2016-02-03 17:17:34 EST
pcp-3.11.0-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-57b7efb2d7
Comment 14 Fedora Update System 2016-03-21 20:17:52 EDT
pcp-3.11.1-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-5b519318e0
Comment 15 Fedora Update System 2016-04-06 10:54:05 EDT
pcp-3.11.1-1.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.

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