Bug 883030 - CMPIBroker->GetInstance called from a CMPI provider changes empty arrays.
Summary: CMPIBroker->GetInstance called from a CMPI provider changes empty arrays.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: tog-pegasus
Version: 18
Hardware: All
OS: All
unspecified
high
Target Milestone: ---
Assignee: Vitezslav Crhonek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-03 16:36 UTC by Jan Safranek
Modified: 2014-04-18 08:44 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1089195 (view as bug list)
Environment:
Last Closed: 2013-01-18 20:52:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Experimental patch (1013 bytes, patch)
2012-12-03 16:36 UTC, Jan Safranek
no flags Details | Diff

Description Jan Safranek 2012-12-03 16:36:27 UTC
Created attachment 656789 [details]
Experimental patch

Description of problem:
I have a CMPI provider, which calls CMPIBroker->getInstance(). The call returns CMPIInstance 'i' with several properties, one of them is  uint16[] with "empty array" value, i.e. it's not Null and its size is 0. But i->ft->getPropertyAt() returns Null instead of empty array.


Version-Release number of selected component (if applicable):
tog-pegasus-2.12.0-2.fc18.x86_64

Looking at Pegasus implementation of getPropertyAt:

        SCMO_RC src = inst->getPropertyAt((Uint32)pos,
                                          &pName,
                                          type,
                                          &value,
                                          isArray,
                                          size);

After the above call: value = NULL, isArray == true, size == 0, i.e. everything is fine. Following code is then executed:

        switch(src)
        {
            case SCMO_OK:
            {
                CMPIType ct=type2CMPIType(type, isArray);
                CMPISCMOUtilities::scmoValue2CMPIData(value, ct, &data, size);
                if ((ct&~CMPI_ARRAY) == CMPI_string)
                {
                    // We always receive strings as an array of pointers
                    // with at least one element, which needs to be released
                    // after it was converted to CMPIData
                    free((void*)value);
                }
                break;

Since value == NULL, CMPISCMOUtilities::scmoValue2CMPIData() sets data->state to CMPI_nullValue, which is wrong. It should set it to empty array!

Attached patch fixes the behavior for me.

Comment 1 Fedora Update System 2013-01-08 14:24:53 UTC
tog-pegasus-2.12.0-4.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/tog-pegasus-2.12.0-4.fc18

Comment 2 Fedora Update System 2013-01-08 20:15:34 UTC
Package tog-pegasus-2.12.0-4.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing tog-pegasus-2.12.0-4.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-0401/tog-pegasus-2.12.0-4.fc18
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2013-01-18 20:52:26 UTC
tog-pegasus-2.12.0-4.fc18 has been pushed to the Fedora 18 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.