Summary: | sys-apps/portage: UnicodeEncodeError: 'utf-8' codec can't encode characters: surrogates not allowed | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Vladimir Varlamov <bes.internal> |
Component: | Core | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | minor | Keywords: | InVCS |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 721152 |
Description
Vladimir Varlamov
2020-05-07 09:27:48 UTC
To clarify: are you intentionally trying to break portage by setting a strange hostname? (In reply to Mike Gilbert from comment #1) > To clarify: are you intentionally trying to break portage by setting a > strange hostname? Not at all, but do you think in 2020 it is permissible to fall on the encoding from the Basic Plane Unicode from 1999? If I can create file with this symbol then what's the problem? Plese there is no place to find out why python works so badly with Unicode and generally emotionally debate. But what I see is an incompletely well-written program. So you really use unicode symbol [ᛜ] 16DC RUNIC LETTER INGWAZ as your hostname normally? I'm not saying this is not a valid bug, but at least be honest about your intentions. Seriously. I bought a domain. https://ᛜ.net/ (In reply to Vladimir Varlamov from comment #4) > Seriously. I bought a domain. https://ᛜ.net/ That gets translated to https://xn--txe.net/ by modern user agents. Probably a limitation of DNS or HTTP. (In reply to Vladimir Varlamov from comment #0) > for emerge perl at install or qmerge phase when created hardlock tmp file: > > Traceback (most recent call last): > File "/usr/lib/portage/python3.6/ebuild-ipc.py", line 277, in <module> > sys.exit(ebuild_ipc_main(sys.argv[1:])) > File "/usr/lib/portage/python3.6/ebuild-ipc.py", line 273, in > ebuild_ipc_main > return ebuild_ipc.communicate(args) > File "/usr/lib/portage/python3.6/ebuild-ipc.py", line 130, in communicate > lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True) > File "/usr/lib64/python3.6/site-packages/portage/locks.py", line 135, in > lockfile > unlinkfile=unlinkfile, waiting_msg=waiting_msg, flags=flags) > File "/usr/lib64/python3.6/site-packages/portage/locks.py", line 324, in > _lockfile_iteration > (removed, fstat_result) = _lockfile_was_removed(myfd, lockfilename) > File "/usr/lib64/python3.6/site-packages/portage/locks.py", line 379, in > _lockfile_was_removed > hardlink_path = hardlock_name(lock_path) > File "/usr/lib64/python3.6/site-packages/portage/locks.py", line 519, in > hardlock_name > (tail, os.uname()[1], os.getpid())) The trigger is the os.uname()[1] usage here. We can use something like portage._decode_argv([os.uname()[1]])[0] to translate the surrogate here. > We can use something like
> portage._decode_argv([os.uname()[1]])[0] to translate the surrogate here.
Tested. It works!
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=def3574d3fe9b944dd83e561462ccc6de6f90ff3 commit def3574d3fe9b944dd83e561462ccc6de6f90ff3 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2020-05-07 20:32:03 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2020-05-07 20:34:02 +0000 locks: translate surrogate from uname (bug 721402) Prevent an error like this when attempting to encode a surrogate: UnicodeEncodeError: 'utf-8' codec can't encode characters in position 20-22: surrogates not allowed Tested-by: Vladimir Varlamov <bes.internal@gmail.com> Bug: https://bugs.gentoo.org/721402 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/locks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77960c6cf984530dbcab9fe507e170e7a2fe7dcf commit 77960c6cf984530dbcab9fe507e170e7a2fe7dcf Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2020-05-25 00:20:07 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2020-05-25 00:20:58 +0000 sys-apps/portage: Bump to version 2.3.100 #715108 Change default BINPKG_COMPRESS to zstd #719456 Add dependency on app-arch/zstd #720866 Do not set PKG_CONFIG_PATH #721402 Hostname UnicodeEncodeError surrogates not allowed #721516 Suppress precompressed QA notice for docompress -x Bug: https://bugs.gentoo.org/721152 Bug: https://bugs.gentoo.org/715108 Bug: https://bugs.gentoo.org/719456 Bug: https://bugs.gentoo.org/720866 Bug: https://bugs.gentoo.org/721402 Bug: https://bugs.gentoo.org/721516 Package-Manager: Portage-2.3.100, Repoman-2.3.22 Signed-off-by: Zac Medico <zmedico@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-2.3.100.ebuild | 261 ++++++++++++++++++++++++++++++++ 2 files changed, 262 insertions(+) |