Bug 821397 - when fault_occurred is set, fault_string is NULL in xmlrpc_env
Summary: when fault_occurred is set, fault_string is NULL in xmlrpc_env
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: xmlrpc-c
Version: 17
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Enrico Scholz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-14 11:14 UTC by Nikola Pajkovsky
Modified: 2014-02-02 22:16 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-21 08:47:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Nikola Pajkovsky 2012-05-14 11:14:55 UTC
I have a following code. It parses bug_id element from bugzilla response. What happened in recent time, redhat bugzilla 4.2 has dropped 'bug_id' element and now it's only 'id' element.

void abrt_xmlrpc_die(xmlrpc_env *env)
{
    error_msg_and_die("fatal: %s", env->fault_string);
}

/* die or return bug id; each bug must have bug id otherwise xml is corrupted */
int rhbz_bug_id(xmlrpc_value* xml)
{
    func_entry();

    xmlrpc_env env;
    xmlrpc_env_init(&env);

    xmlrpc_value *item = NULL;
    xmlrpc_value *bug = NULL;
    int bug_id = -1;;

    xmlrpc_array_read_item(&env, xml, 0, &item);
    if (env.fault_occurred)
        abrt_xmlrpc_die(&env);

    bug = rhbz_get_member("id", item);
    xmlrpc_DECREF(item);
    if (!bug)
        abrt_xmlrpc_die(&env);

    xmlrpc_read_int(&env, bug, &bug_id);
    xmlrpc_DECREF(bug);
    if (env.fault_occurred)
        abrt_xmlrpc_die(&env);

    VERB3 log("found bug_id %i", bug_id);
    return bug_id;
}

Version-Release number of selected component (if applicable):
[npajkovs@f17-virt libreport]$ rpm -q xmlrpc-c
xmlrpc-c-1.29.0-1701.svn2233.fc17.x86_64

 
Actual results:
env->fault_string is set to NULL

Expected results:
env->fault_string is set to appropriate error msg

Comment 1 Enrico Scholz 2012-05-14 20:44:30 UTC
I am not sure whether I understand you correctly, but I can not detect the mentioned "bug_id" literal in the posted piece of code.

Assuming, it's the new version where "bug_id" has been replaced by "id", then the

---
    /*  ---> at this point env.fault_occurred is false and env.fault_string
        is unspecified */

    bug = rhbz_get_member("id", item);
    xmlrpc_DECREF(item);
    if (!bug)
        abrt_xmlrpc_die(&env);
---

part is probably wrong because when rhbz_get_member() fails (--> returns NULL) the &env variable stays unmodified.

Comment 2 Nikola Pajkovsky 2012-05-21 08:47:56 UTC
Ah, you are right.


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