1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-22 02:06:18 +02:00
github.com_openSUSE_osc/osc/util
Marcus Huewe 36f7b8ffe9 Fix a potential TypeError in CpioRead.copyin and CpioRead.copyin_file
If no "dest" argument is specified when calling CpioRead.copyin or
CpioRead.copyin_file, a TypeError occurs in CpioRead._copyin_file
because os.getcwd(), which returns a str, is used as dest and, hence,
the subsequent os.path.join(...) fails (because it tries to join a
str and a bytes).
In order to avoid this, encode the result of os.getcwd().

Note that the existing

archive.copyin_file(hdr.filename,
                    os.path.dirname(tmpfile),
                    os.path.basename(tmpfile))

was OK because CpioRead._copyin_file os.path.join()s "dest" and
"new_fn", which are both str. It is just changed to stress that
CpioRead is a bytes-only API.

Fixes: #865 ("Traceback in osc/util/cpio.py line 128: TypeError:
Can't mix strings and bytes in path components")
2020-11-20 09:55:09 +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 Use with statement in ArFile.saveTo 2019-01-15 17:18:50 +01:00
archquery.py Remove superfluous try-except block in the archquery module 2019-01-27 16:51:58 +01:00
cpio.py Fix a potential TypeError in CpioRead.copyin and CpioRead.copyin_file 2020-11-20 09:55:09 +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