1 |
commit: def3574d3fe9b944dd83e561462ccc6de6f90ff3 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 7 20:32:03 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 7 20:34:02 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=def3574d |
7 |
|
8 |
locks: translate surrogate from uname (bug 721402) |
9 |
|
10 |
Prevent an error like this when attempting to encode a surrogate: |
11 |
|
12 |
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 20-22: surrogates not allowed |
13 |
|
14 |
Tested-by: Vladimir Varlamov <bes.internal <AT> gmail.com> |
15 |
Bug: https://bugs.gentoo.org/721402 |
16 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
17 |
|
18 |
lib/portage/locks.py | 6 +++--- |
19 |
1 file changed, 3 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/lib/portage/locks.py b/lib/portage/locks.py |
22 |
index 2331e6f57..535698dfe 100644 |
23 |
--- a/lib/portage/locks.py |
24 |
+++ b/lib/portage/locks.py |
25 |
@@ -1,5 +1,5 @@ |
26 |
# portage: Lock management code |
27 |
-# Copyright 2004-2019 Gentoo Authors |
28 |
+# Copyright 2004-2020 Gentoo Authors |
29 |
# Distributed under the terms of the GNU General Public License v2 |
30 |
|
31 |
__all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \ |
32 |
@@ -516,7 +516,7 @@ def unlockfile(mytuple): |
33 |
def hardlock_name(path): |
34 |
base, tail = os.path.split(path) |
35 |
return os.path.join(base, ".%s.hardlock-%s-%s" % |
36 |
- (tail, os.uname()[1], os.getpid())) |
37 |
+ (tail, portage._decode_argv([os.uname()[1]])[0], os.getpid())) |
38 |
|
39 |
def hardlink_is_mine(link, lock): |
40 |
try: |
41 |
@@ -672,7 +672,7 @@ def unhardlink_lockfile(lockfilename, unlinkfile=True): |
42 |
pass |
43 |
|
44 |
def hardlock_cleanup(path, remove_all_locks=False): |
45 |
- myhost = os.uname()[1] |
46 |
+ myhost = portage._decode_argv([os.uname()[1]])[0] |
47 |
mydl = os.listdir(path) |
48 |
|
49 |
results = [] |