From 54ac438eb0ef33ba27d9c1d3c5dd1840fa2189ec Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Tue, 15 Jan 2019 19:47:27 +0100 Subject: [PATCH] Do not mmap a cpio archive There is simply no need for a mmap. --- osc/util/cpio.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/osc/util/cpio.py b/osc/util/cpio.py index 4a97cf5a..021a5d2e 100644 --- a/osc/util/cpio.py +++ b/osc/util/cpio.py @@ -147,16 +147,6 @@ class CpioRead: def read(self): if not self.__file: self.__file = open(self.filename, 'rb') - try: - if sys.platform[:3] != 'win': - self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name), prot = mmap.PROT_READ) - else: - self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name)) - except EnvironmentError as e: - if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ): - print('cannot use mmap to read the file, failing back to default', file=sys.stderr) - else: - raise e else: self.__file.seek(0, os.SEEK_SET) self._init_datastructs()