Bug 1684004
| Summary: | UnicodeError in inspect_list_applications2 | ||
|---|---|---|---|
| Product: | [Community] Virtualization Tools | Reporter: | Sam <shmuel.eiderman> |
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
| Status: | NEW --- | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | unspecified | CC: | ptoscano, sameid |
| Target Milestone: | --- | Keywords: | Reopened |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2025-10-17 00:10:54 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Sam
2019-02-28 09:22:47 UTC
? Python bindings are broken with respect to handling improperly encoded strings. There is another BZ about this but I can't find it right now ... Here we go: https://bugzilla.redhat.com/show_bug.cgi?id=1661871 See if the fix for that fixes this issue. (In reply to Richard W.M. Jones from comment #3) > Here we go: > https://bugzilla.redhat.com/show_bug.cgi?id=1661871 This was a different issue. See this old series: https://www.redhat.com/archives/libguestfs/2017-May/msg00076.html (v1 is no more needed, https://github.com/libguestfs/libguestfs/commit/0ee02e0117527b86a31b2a88a14994ce7f15571f was a better fix for it) This has nothing to do to with PyBytes_FromStringAndSize. The problem is that PyUnicode_FromString (which is the correct function to call in python3) fails on a package description string that contains invalid unicode (actually utf-8) symbols. I used PyUnicode_DecodeLocale(str, "surrogateescape") as a temporary fix. Sam More on the issue of "surroageescape": https://www.python.org/dev/peps/pep-0383/ Sam Gentle ping (new email) Nothing's really going to happen until someone submits a fix for the Python bindings string handling. (In reply to Richard W.M. Jones from comment #8) > Nothing's really going to happen until someone submits a fix for > the Python bindings string handling. True, But what do you think the fix should be? Treat app2_description as utf8 string (even when it is not, can be latin1 or anything else) and use PyUnicode_DecodeLocale(str, "surrogateescape") - to skip errors. Or should we change app2_description to FBytes in generator/structs.ml - and treat it as bytes? In my opinion we should treat the description as utf8 and use surrogateesacpe, since the desctiption should be a utf8 string and the bug is actually in PackageKit. (As can be seen, they fixed it in recent versions: https://github.com/hughsie/PackageKit/commit/7a92f842830e3ea9122463fe279f0b42150cbd63) Sam Soryy(In reply to Sam Eiderman from comment #9) > (In reply to Richard W.M. Jones from comment #8) > > Nothing's really going to happen until someone submits a fix for > > the Python bindings string handling. > > True, > > But what do you think the fix should be? > Treat app2_description as utf8 string (even when it is not, can be latin1 or > anything else) and use PyUnicode_DecodeLocale(str, "surrogateescape") - to > skip errors. > Or should we change app2_description to FBytes in generator/structs.ml - and > treat it as bytes? > > In my opinion we should treat the description as utf8 and use > surrogateesacpe, since the desctiption should be a utf8 string and the bug > is actually in PackageKit. > (As can be seen, they fixed it in recent versions: > https://github.com/hughsie/PackageKit/commit/ > 7a92f842830e3ea9122463fe279f0b42150cbd63) > > Sam Sorry, I think PyUnicode_DecodeLocale isn't appropriate (uses the current locale instead utf-8), maybe we should just return an empty string if PyUnicode_FromString fails? This product has been discontinued or is no longer tracked in Red Hat Bugzilla. Reopening because Virtualization Tools has not been discontinued. |