Bug 821397 - when fault_occurred is set, fault_string is NULL in xmlrpc_env
when fault_occurred is set, fault_string is NULL in xmlrpc_env
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: xmlrpc-c (Show other bugs)
17
Unspecified Unspecified
high Severity high
: ---
: ---
Assigned To: Enrico Scholz
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-14 07:14 EDT by Nikola Pajkovsky
Modified: 2014-02-02 17:16 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-21 04:47:56 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 Nikola Pajkovsky 2012-05-14 07:14:55 EDT
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 16:44:30 EDT
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 04:47:56 EDT
Ah, you are right.

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