rpm-software-management/createrepo_c

cr_xml_dump_int() should point to a forbidden character

ppisar opened this issue · 2 comments

struct cr_XmlStruct cr_xml_dump_int(cr_Package *pkg, gboolean filelists_ext, GError **err) correctly rejects a package whose metadata cannot be represented in XML:

    if (cr_Package_contains_forbidden_control_chars(pkg)) {
        g_set_error(err, CREATEREPO_C_ERROR, CRE_XMLDATA,
                    "Forbidden control chars found (ASCII values <32 except 9, 10 and 13).");
        return result;
    }

But the callers would like to know where the forbidden character is. Requested in #165 (comment).

Because cr_Package_contains_forbidden_control_chars() and lower functions are in public createrepo_c/xml_dump.h header file and they miss an argument for returning the precise location, a fix will need to add new functions (and wrap the current ones) not to break ABI.

PR #425 added printing warning messages which pinpoints a package name, RPM tag name and RPM tag value.

This issue is kept open to:

  • Report exact byte offset in the tag values (it's difficult to locate the offending nonprintablecharacters in the output).
  • Store the warnings into an error buffer and let the caller to print it.