Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 741194 - sys-apps/portage-3.0.4 with selinux !!! 'latin-1' codec can't encode character '\u0151' in position 28: ordinal not in range(256)
Summary: sys-apps/portage-3.0.4 with selinux !!! 'latin-1' codec can't encode characte...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 430488
Blocks: 739718
  Show dependency tree
 
Reported: 2020-09-08 13:56 UTC by rjgleits
Modified: 2020-11-22 07:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,6.44 KB, text/plain)
2020-09-08 13:56 UTC, rjgleits
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rjgleits 2020-09-08 13:56:59 UTC
Created attachment 659158 [details]
emerge --info

Hi,

I get the following during installation of app-misc/ca-certificates-20200601.3.53:

!!! failed to properly create symlink:
!!! /etc/ssl/certs/._cfg0000_988a38cb.0 -> NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem
!!! 'latin-1' codec can't encode character '\u0151' in position 28: ordinal not in range(256)
!!! Failed to move file.
!!! /etc/ssl/certs/._cfg0000_988a38cb.0 -> NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem

Not sure where to start. I've seen recommendations to use the utf-8 character set instead of latin-1, but I have no idea where this is done.

Thanks for any help you can offer.


Bob Gleitsmann
Comment 1 rjgleits 2020-09-08 18:04:57 UTC
So, I discovered the UTF-8 guide in the Gentoo wiki. Please give me a chance to digest it before doing any work on this bug.

Thanks.
Comment 2 Jonas Stein gentoo-dev 2020-09-08 18:06:10 UTC
I can install the package properly, but I do not like the idea of UTF-8 filenames.

/etc/ssl/certs$ ls -al 988a38cb.0 
lrwxrwxrwx 1 root root 48 2020-06-03 01:31 988a38cb.0 -> 'NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem'

This should be changed.
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2020-09-08 18:28:52 UTC
> [...] but I do not like the idea of UTF-8 filenames.

Maybe I am missing your point but using UTF-8 is totally fine. And given that it's included in source tarball already there is also nothing we can do here in case we would really like to be able to support non-UTF8 systems (chicken/egg problem -- you wouldn't be able to unpack without UTF8 support at all so we cannot even rename).

Please try to convince upstream to change name in case you really care.
Comment 4 Mike Gilbert gentoo-dev 2020-09-08 19:53:22 UTC
This looks like a bug in portage, possibly related to the selinux code path.
Comment 5 Zac Medico gentoo-dev 2020-09-08 20:34:19 UTC
Looks like the issue is probably that the os.symlink call inside portage._selinux.symlink does not encode the arguments as UTF-8. The code has not changed since this commit back on 2009-08-06:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=25c5202b7e66bbef5b058fd9679070877bc54ed7
Comment 6 Zac Medico gentoo-dev 2020-09-08 20:37:40 UTC
Actually, the last change to encoding behavior was from this commit related to bug 430488 on 2013-01-14:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=6137290b2bb8353db0df1a7664e435ced37bacfd
Comment 7 Zac Medico gentoo-dev 2020-09-08 20:40:17 UTC
This bug is an unintended result of the fix for bug 430488, since that made it pass unicode strings to the os.symlink call, instead of UTF-8 encoded bytes.
Comment 9 rjgleits 2020-09-10 20:25:48 UTC
I tried to use the patch, but the patching itself fails for obscure reasons. Is it not compatible with portage-3.0.4-r1? I was trying to copy and paste it from the web page and that did not go well. Is there another way?

Thanks.
Comment 10 Mike Gilbert gentoo-dev 2020-09-10 21:07:12 UTC
(In reply to rjgleits from comment #9)

It would be easier to grab the patch from github.

https://github.com/gentoo/portage/pull/619.patch
Comment 11 rjgleits 2020-09-10 21:31:41 UTC
Thanks. Got the patch installed and it worked. The certificates package installed correctly.

Thanks!

Best Wishes,

Bob
Comment 12 Larry the Git Cow gentoo-dev 2020-09-11 19:02:07 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=a8f0e05d35b0ba2747827ce03dff42682192def8

commit a8f0e05d35b0ba2747827ce03dff42682192def8
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-09 05:08:20 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-11 19:00:57 +0000

    selinux: encode os path arguments as UTF-8 (bug 741194)
    
    Encode path arguments as UTF-8, like portage.os wrapper.
    
    Fixes: 6137290b2bb8 ("selinux: python3 unicode paths, bug #430488")
    Tested-by: Bob Gleitsmann <rjgleits@bellsouth.net>
    Bug: https://bugs.gentoo.org/741194
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/_selinux.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Comment 13 Zac Medico gentoo-dev 2020-09-11 19:09:46 UTC
Thanks for testing!
Comment 14 Larry the Git Cow gentoo-dev 2020-09-11 19:26:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f5468f112ce4a8210fe2073267f842367a7287b

commit 3f5468f112ce4a8210fe2073267f842367a7287b
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-11 19:14:10 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-11 19:25:54 +0000

    sys-apps/portage: 3.0.6-r1 revbump for bug 741194
    
     #741194 selinux: encode os path arguments as UTF-8
    
    Bug: https://bugs.gentoo.org/739718
    Bug: https://bugs.gentoo.org/741194
    Package-Manager: Portage-3.0.6, Repoman-3.0.1
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest                                          | 1 +
 sys-apps/portage/{portage-3.0.6.ebuild => portage-3.0.6-r1.ebuild} | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)