1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00
github.com_openSUSE_osc/osc/util
Marcus Huewe 1933da5bcc Use os.getcwdb() instead of os.getcwd().encode() in util.cpio.CpioRead
Using os.getcwd() in combination with a subsequent .encode() is error
prone:

marcus@linux:~> mkdir illegal_utf-8_encoding_$'\xff'_dir
marcus@linux:~> cd illegal_utf-8_encoding_$'\xff'_dir/
marcus@linux:~/illegal_utf-8_encoding_ÿ_dir> python3
Python 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd().encode()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 36: surrogates not allowed
>>>

Hence, use os.getcwdb(), which returns a bytes, instead of
os.getcwd().encode().

Fixes: commit 36f7b8ffe9 ("Fix a
potential TypeError in CpioRead.copyin and CpioRead.copyin_file")
2020-11-22 17:39:54 +01:00
..
__init__.py - don't fail if terminal encoding doesn't support unicode (fixes #660445) 2011-02-11 02:45:13 +01:00
ar.py Avoid a potential TypeError in util.ArFile.saveTo 2020-11-22 17:36:17 +01:00
archquery.py Remove superfluous try-except block in the archquery module 2019-01-27 16:51:58 +01:00
cpio.py Use os.getcwdb() instead of os.getcwd().encode() in util.cpio.CpioRead 2020-11-22 17:39:54 +01:00
debquery.py fix and unify building of local package cache 2019-07-26 13:38:45 +02:00
helper.py Fix python2 regression in util.helper.decode_it 2020-06-25 15:38:14 +02:00
packagequery.py Return bytes in packagequery.PackageQueryResult.evr() instead of a str 2020-03-15 18:30:00 +01:00
repodata.py Fix ElementTree imports for Python 3.9 2020-06-02 15:13:10 -07:00
rpmquery.py fix and unify building of local package cache 2019-07-26 13:38:45 +02:00
safewriter.py Fix and simplify util.safewriter.SafeWriter 2018-03-09 16:55:56 +01:00