Skip to content

Commit

Permalink
StaticFileSet: Fix os.walk for utf8_mode
Browse files Browse the repository at this point in the history
Bug: https://bugs.gentoo.org/916182
Signed-off-by: Zac Medico <zmedico@gentoo.org>
  • Loading branch information
zmedico committed Oct 23, 2023
1 parent c7768ae commit d55ea1d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/portage/_sets/files.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright 2007-2020 Gentoo Authors
# Copyright 2007-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

import errno
import re
from itertools import chain

import portage
from portage import os
from portage import _encodings
from portage import _unicode_decode
Expand Down Expand Up @@ -176,6 +177,11 @@ def multiBuilder(self, options, settings, trees):
directory = normalize_path(directory)

for parent, dirs, files in os.walk(directory):
if portage.utf8_mode:
parent = os.fsencode(parent)
dirs = [os.fsencode(value) for value in dirs]
files = [os.fsencode(value) for value in files]

try:
parent = _unicode_decode(
parent, encoding=_encodings["fs"], errors="strict"
Expand Down

0 comments on commit d55ea1d

Please sign in to comment.