buildinfohelper: work around unicode exceptions
PATCH 1/1 buildinfohelper: work around unicode exceptions
We have been seeing UnicodeDecodeError's 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]
--- bitbake/lib/bb/ui/buildinfohelper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +6 -4
@@ -483,7 +483,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,
@@ -508,7 +508,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,
@@ -539,7 +539,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
@@ -548,7 +550,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,
Signature · 1 line
2.5.5
Submitted to bitbake-devel and pushed to toaster-next.
Thanks.
Elliot
Quoted 72 lines · Joshua Lock
We have been seeing UnicodeDecodeError's 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 <[email protected]>--- bitbake/lib/bb/ui/buildinfohelper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)bitbake/lib/bb/ui/buildinfohelper.py +1
-1@@ -483,7 +483,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,
bitbake/lib/bb/ui/buildinfohelper.py +4
-2@@ -508,7 +508,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,@@ -539,7 +539,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 = Nonebitbake/lib/bb/ui/buildinfohelper.py +1
-2@@ -548,7 +550,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, --2.5.5
--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
Signature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre