[oe-commits] [bitbake] 39/45: buildinfohelper: work around unicode exceptions

git at git.openembedded.org git at git.openembedded.org
Wed Apr 6 22:11:57 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit f50fff03b3de02e73a3cc2eb9935f7c345dbddc4
Author: Joshua Lock <joshua.g.lock at intel.com>
AuthorDate: Wed Apr 6 13:50:23 2016 +0100

    buildinfohelper: work around unicode exceptions
    
    We have been seeing UnicodeDecodeErrors when handling the
    ImagePkgList MetadataEvent in ORMWrapper's
    save_target_file_information() if the event includes filenames
    that include non-ASCII characters.
    
    In the short term work around this by converting paths to the
    unicode type when passing them to Django's ORM. This is a bit of
    a hack but it's too late in the cycle to do anything more invasive.
    
    [YOCTO #9142]
    
    Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/ui/buildinfohelper.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 1473a67..9397905 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -494,7 +494,7 @@ class ORMWrapper(object):
             parent_obj = self._cached_get(Target_File, target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY)
             tf_obj = Target_File.objects.create(
                         target = target_obj,
-                        path = path,
+                        path = unicode(path, 'utf-8'),
                         size = size,
                         inodetype = Target_File.ITYPE_DIRECTORY,
                         permission = permission,
@@ -519,7 +519,7 @@ class ORMWrapper(object):
 
             tf_obj = Target_File.objects.create(
                         target = target_obj,
-                        path = path,
+                        path = unicode(path, 'utf-8'),
                         size = size,
                         inodetype = inodetype,
                         permission = permission,
@@ -550,7 +550,9 @@ class ORMWrapper(object):
                 filetarget_path = "/".join(fcpl)
 
             try:
-                filetarget_obj = Target_File.objects.get(target = target_obj, path = filetarget_path)
+                filetarget_obj = Target_File.objects.get(
+                                     target = target_obj,
+                                     path = unicode(filetarget_path, 'utf-8'))
             except Target_File.DoesNotExist:
                 # we might have an invalid link; no way to detect this. just set it to None
                 filetarget_obj = None
@@ -559,7 +561,7 @@ class ORMWrapper(object):
 
             tf_obj = Target_File.objects.create(
                         target = target_obj,
-                        path = path,
+                        path = unicode(path, 'utf-8'),
                         size = size,
                         inodetype = Target_File.ITYPE_SYMLINK,
                         permission = permission,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list