leapp-repository/0017-Fix-false-positive-non-utf-symlinks-reported.patch
Petr Stodulka c64266d19b Pre CTC2 candidate
- Introduce new upgrade path RHEL 8.9 -> 9.3
- Update leapp data files to reflect new changes between systems
- Detect and report use of deprecated Xorg drivers
- Minor improvements of generated reports
- Fix false positive report about invalid symlinks
- Inhibit the upgrade when unsupported x86-64 microarchitecture is detected
- Resolves: rhbz#2215997
2023-06-19 23:53:40 +02:00

39 lines
1.7 KiB
Diff

From a600097a8f5ab9f0083a9abb906e0a0b5394176c Mon Sep 17 00:00:00 2001
From: Inessa Vasilevskaya <ivasilev@redhat.com>
Date: Wed, 8 Mar 2023 12:12:51 +0100
Subject: [PATCH 17/30] Fix false positive non-utf symlinks reported
Because of botched up check for python2 valid utf symlinks were reported
as non-utf ones.
OAMG-8629
---
.../system_upgrade/common/actors/rootscanner/actor.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/repos/system_upgrade/common/actors/rootscanner/actor.py b/repos/system_upgrade/common/actors/rootscanner/actor.py
index 515fd7d7..dc02c7a2 100644
--- a/repos/system_upgrade/common/actors/rootscanner/actor.py
+++ b/repos/system_upgrade/common/actors/rootscanner/actor.py
@@ -28,8 +28,16 @@ class RootScanner(Actor):
return subdir_cls(name=name)
for subdir in os.listdir('/'):
- # Note(ivasilev) non-utf encoded string will appear as byte strings
+ # Note(ivasilev) in py3 env non-utf encoded string will appear as byte strings
+ # However in py2 env subdir will be always of str type, so verification if this is a valid utf-8 string
+ # should be done differently than formerly suggested plain six.binary_type check
+ decoded = True
if isinstance(subdir, six.binary_type):
+ try:
+ subdir.decode('utf-8')
+ except (AttributeError, UnicodeDecodeError):
+ decoded = False
+ if not decoded:
invalid_subdirs.append(_create_a_subdir(InvalidRootSubdirectory, subdir, os.path.join(b'/', subdir)))
else:
subdirs.append(_create_a_subdir(RootSubdirectory, subdir, os.path.join('/', subdir)))
--
2.40.1