From 834c520000e712e4ab2214a9a35a68a2a19473a3 Mon Sep 17 00:00:00 2001 From: Michael Weiser Date: Fri, 31 Aug 2018 13:19:31 +0100 Subject: [PATCH] Make symlink creation failure an error again Ignoring OSError was introducted in commit 737eaa30 likely to ignore EEXISTS errors when another thread had already created an identical symlink due to a race condition. While this was never good because the underlying race condition would still be there, it also made us blind to other errors such as missing permissions or exhaustion of inodes on the target file system. Using tempfile.mkdtemp to create the workdir should reliably avoid any race condition now and make this selective blindspot unnecessary (as long as the same sample isn't analysed by multiple threads - whoa). --- peekaboo/sample.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/peekaboo/sample.py b/peekaboo/sample.py index 1b2c38ff..71d88212 100644 --- a/peekaboo/sample.py +++ b/peekaboo/sample.py @@ -111,10 +111,7 @@ def init(self): '%s.%s' % (self.sha256sum, file_ext)) logger.debug('ln -s %s %s' % (self.__path, self.__submit_path)) - try: - os.symlink(self.__path, self.__submit_path) - except OSError: - pass + os.symlink(self.__path, self.__submit_path) self.initialized = True