From cc2a502c8272fb5228051ad8068da177016c6814 Mon Sep 17 00:00:00 2001 From: Inessa Vasilevskaya Date: Thu, 28 Jul 2022 13:08:37 +0200 Subject: [PATCH] Use ByteString field for RootDirectory A root_scanner unit test for non-utf8 filename has been added as well. OAMG-4306 Depends-On: https://github.com/oamg/leapp/pull/789 --- .../checkrootsymlinks/tests/unit_test_checkrootsymlinks.py | 3 ++- repos/system_upgrade/common/models/rootdirectory.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/repos/system_upgrade/common/actors/checkrootsymlinks/tests/unit_test_checkrootsymlinks.py b/repos/system_upgrade/common/actors/checkrootsymlinks/tests/unit_test_checkrootsymlinks.py index e6f4542e77..fbc3090351 100644 --- a/repos/system_upgrade/common/actors/checkrootsymlinks/tests/unit_test_checkrootsymlinks.py +++ b/repos/system_upgrade/common/actors/checkrootsymlinks/tests/unit_test_checkrootsymlinks.py @@ -9,7 +9,8 @@ ({'bin': '/usr/bin'}, True), ({'sbin': 'usr/bin'}, False), ({'sbin': '/usr/sbin'}, True), - ({'lib': '/usr/lib', 'lib64': 'usr/lib64'}, True)]) + ({'lib': '/usr/lib', 'lib64': 'usr/lib64'}, True), + ({b'\xc4\xc9\xd2\xc5\xcb\xd4\xcf\xd2\xc9\xd1': ''}, False)]) def test_wrong_symlink_inhibitor(current_actor_context, modified, expected_report): subdirs = { 'bin': 'usr/bin', diff --git a/repos/system_upgrade/common/models/rootdirectory.py b/repos/system_upgrade/common/models/rootdirectory.py index 930e7441c1..6e86908c46 100644 --- a/repos/system_upgrade/common/models/rootdirectory.py +++ b/repos/system_upgrade/common/models/rootdirectory.py @@ -1,4 +1,4 @@ -from leapp.models import Model, fields +from leapp.models import fields, Model from leapp.topics import SystemFactsTopic @@ -7,7 +7,7 @@ class RootSubdirectory(Model): Representation of a single root subdirectory. Can be expanded as needed. """ topic = SystemFactsTopic - name = fields.String() + name = fields.ByteString() target = fields.Nullable(fields.String()) # if it's a link