pcp
[Top] [All Lists]

[Bug 1286733] Invalid Python PMAPI pmRegisterDerived call crashes libpcp

To: pcp@xxxxxxxxxxx
Subject: [Bug 1286733] Invalid Python PMAPI pmRegisterDerived call crashes libpcp
From: bugzilla@xxxxxxxxxx
Date: Thu, 03 Dec 2015 03:48:08 +0000
Authentication-results: i-otc2esa.cbr1.mail-filtering.com.au; spf=Pass smtp.mailfrom=bugzilla@xxxxxxxxxx; spf=Pass smtp.helo=postmaster@xxxxxxxxxxxxxxxxxxx
Auto-submitted: auto-generated
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <bug-1286733-355098@xxxxxxxxxxxxxxxxxxx>
Ironport-phdr: 9a23:UgJ1uB0NUHb5vsDIsmDT+DRfVm0co7zxezQtwd8ZsegULPad9pjvdHbS+e9qxAeQG96Eu7QZ06L/iOPJZy8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2v7+SLpqGZOUlWibUsmbtnzAZPY2sSry/ipqdqUaRhHlju5Zbo0Nhi6rQzN8MIRhMx+LaU8zF3CrXofZ7FKnEdTL2u5pQj3qM7l95VU7iJLpvg6/NRBW6ipQ6NtVbdAJDcrNWJz78ru8xDeHiWV4X5JWHgZgBtMBwHt9hz2Xp7t9CD9s7kukBKGNNH7GOhnEQ+p6L1mHUKwhQ==
References: <bug-1286733-355098@xxxxxxxxxxxxxxxxxxx>
https://bugzilla.redhat.com/show_bug.cgi?id=1286733



--- Comment #2 from Nathan Scott <nathans@xxxxxxxxxx> ---
Hi Marko,

(In reply to Marko Myllynen from comment #0)
> Created attachment 1100522 [details]
> pmapi-test.py
> 
> Description of problem:
> The attached test script exposes two issues around Python PMAPI
> pmRegisterDerived():
> 
> localhost:~> python ~/pmapi-test.py
> zsh: segmentation fault  python ~/pmapi-test.py

The crash happens because to the ctypes wrapper declares pmRegisterDerived(3)
with an integer return type, when it actually returns a string.

> localhost:~> python ~/pmapi-test.py
> REGISTERED 1
> EXCEPTION 2
> 'NoneType' object has no attribute 'decode'
> localhost:~> 
> 

With that fixed, I see the second behaviour above - the NoneType is coming from
pmDerivedErrStr (not sure why, but this seems to always return NULL - might be
something to do with the thread-local-storage used in libpcp for this error
message string).  But, even if we can't get at an error string, we should not
be calling decode() on NoneType unconditionally as the python wrapper code is
currently doing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug 
https://bugzilla.redhat.com/token.cgi?t=t1LSbQBRvc&a=cc_unsubscribe

<Prev in Thread] Current Thread [Next in Thread>