#383 [BZ] Fedpkg often fails when a parent directory contains non-ASCII
Closed: Invalid 4 years ago by onosek. Opened 5 years ago by cqi.


This is probably due to Unicode handling differences between Python 2 and Python 3: self.path gets set to the likes of u'/tmp/göran', and Python 2 will fail trying to convert that with str() in /usr/lib/python2.7/site-packages/git/repo/base.py:

[tim@passepartout ~]$ echo $LANG
de_DE.UTF-8
[tim@passepartout ~]$ git init /tmp/göran
Leeres Git-Repository in /tmp/göran/.git/ initialisiert
[tim@passepartout ~]$ python3 -c "import git; g = git.Repo(u'/tmp/göran')"
[tim@passepartout ~]$ python2 -c "import git; g = git.Repo(u'/tmp/göran')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/git/repo/base.py", line 125, in __init__
    epath = str(epath)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128)
[tim@passepartout ~]$ python3 -c "str(u'/tmp/göran')"
[tim@passepartout ~]$ python2 -c "str(u'/tmp/göran')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128)
[tim@passepartout ~]$

Changing the call in pyrpkg.Commands.load_repo() to:

            self._repo = git.Repo(self.path.encode('UTF-8'))

works for me (Fedora 28 with German locale), but is probably not The Right Thing™ to do.

Original BZ ticket was closed. I tried it on F30 and F31 and it worked.

Metadata Update from @onosek:
- Issue close_status updated to: Invalid
- Issue status updated to: Closed (was: Open)

4 years ago

Login to comment on this ticket.

Metadata