Bug 1287778 - Python PMAPI pmNonOptionsFromList cryptic error message
Summary: Python PMAPI pmNonOptionsFromList cryptic error message
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nathan Scott
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-02 16:24 UTC by Marko Myllynen
Modified: 2016-04-06 14:55 UTC (History)
7 users (show)

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:
Clone Of:
Environment:
Last Closed: 2016-04-06 14:55:39 UTC
Type: Bug


Attachments (Terms of Use)

Description Marko Myllynen 2015-12-02 16:24:11 UTC
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-03 01:35:45 UTC
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-03 02:10:49 UTC
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-03 04:43:27 UTC
Fixed upstream, will be in pcp-3.10.9.

Comment 4 Fedora Update System 2015-12-17 01:54:48 UTC
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-17 01:55:32 UTC
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-17 02:18:18 UTC
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 10:26:43 UTC
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 10:27:03 UTC
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 12:49:09 UTC
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 21:58:01 UTC
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 22:54:37 UTC
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-03 03:56:57 UTC
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 22:17:34 UTC
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-22 00:17:52 UTC
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 14:54:05 UTC
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.