explicit encoding for text file operations

Fixes: https://pagure.io/koji/issue/2641
This commit is contained in:
Tomas Kopecek 2021-01-14 16:37:47 +01:00
parent ffa0912bc0
commit 96ae0ecef5
29 changed files with 136 additions and 156 deletions

View file

@ -267,7 +267,7 @@ class RunRootTask(koji.tasks.BaseTaskHandler):
self.logger.info('New runroot')
self.logger.info("Runroot mounts: %s" % mounts)
fn = '%s/tmp/runroot_mounts' % rootdir
with open(fn, 'a') as fslog:
with open(fn, 'at', encoding='utf-8') as fslog:
logfile = "%s/do_mounts.log" % self.workdir
uploadpath = self.getUploadDir()
error = None
@ -309,7 +309,7 @@ class RunRootTask(koji.tasks.BaseTaskHandler):
mounts = set()
fn = '%s/tmp/runroot_mounts' % rootdir
if os.path.exists(fn):
with open(fn, 'r') as fslog:
with open(fn, 'rt', encoding='utf-8') as fslog:
for line in fslog.readlines():
mounts.add(line.strip())
# also, check /proc/mounts just in case