1 |
commit: 308e33dc9e0cba958a583d86799dcb660ba39cb1 |
2 |
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 6 18:25:39 2017 +0000 |
4 |
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 6 18:25:39 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=308e33dc |
7 |
|
8 |
equery: size: Fix UnicodeDecodeError |
9 |
|
10 |
Encode the filename before calling os.lstat |
11 |
|
12 |
X-Gentoo-Bug: 531636 |
13 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/531636 |
14 |
|
15 |
pym/gentoolkit/package.py | 3 ++- |
16 |
1 file changed, 2 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py |
19 |
index 42b632b..149ca74 100644 |
20 |
--- a/pym/gentoolkit/package.py |
21 |
+++ b/pym/gentoolkit/package.py |
22 |
@@ -46,6 +46,7 @@ from string import Template |
23 |
|
24 |
import portage |
25 |
from portage.util import LazyItemsDict |
26 |
+from portage import _encodings, _unicode_decode, _unicode_encode |
27 |
|
28 |
import gentoolkit.pprinter as pp |
29 |
from gentoolkit import errors |
30 |
@@ -380,7 +381,7 @@ class Package(CPV): |
31 |
size = n_files = n_uncounted = 0 |
32 |
for path in self.parsed_contents(prefix_root=True): |
33 |
try: |
34 |
- st = os.lstat(path) |
35 |
+ st = os.lstat(_unicode_encode(path, encoding=_encodings['fs'])) |
36 |
except OSError: |
37 |
continue |