Skip to content

Commit

Permalink
Make symlink creation failure an error again
Browse files Browse the repository at this point in the history
Ignoring OSError was introducted in commit 737eaa3 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).
  • Loading branch information
michaelweiser committed Aug 31, 2018
1 parent 7ca5bb2 commit 834c520
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions peekaboo/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 834c520

Please sign in to comment.