Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 23956E00B6F; Tue, 5 Apr 2016 04:02:14 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.93 listed in list.dnswl.org] Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E9378E00AE4 for ; Tue, 5 Apr 2016 04:02:10 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 05 Apr 2016 04:02:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,443,1455004800"; d="scan'208";a="925733704" Received: from jlock-mobl1.gar.corp.intel.com (HELO jlock-mobl.gar.corp.intel.com) ([10.252.26.223]) by orsmga001.jf.intel.com with ESMTP; 05 Apr 2016 04:02:09 -0700 From: Joshua Lock To: toaster@yoctoproject.org Date: Tue, 5 Apr 2016 12:02:02 +0100 Message-Id: <1459854122-4127-1-git-send-email-joshua.g.lock@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [PATCH] buildinfohelper: work around unicode exceptions X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 11:02:14 -0000 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 --- bitbake/lib/bb/ui/buildinfohelper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index ed43f4c..c211ec6 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -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, -- 2.5.5