From: Philipp Gesang Date: Thu, 5 Jul 2018 08:54:31 +0000 (+0200) Subject: guard call to stat() against ENOENT X-Git-Tag: v2.2~6^2~2 X-Git-Url: http://developer.intra2net.com/git/?p=python-delta-tar;a=commitdiff_plain;h=fd743c2636546a903a503c9cbdbc93de71c789d9 guard call to stat() against ENOENT Move the implicit call to stat(2) into the ENOENT-safe block we just introduced. Found by unit testing. --- diff --git a/deltatar/deltatar.py b/deltatar/deltatar.py index 161008c..03de734 100644 --- a/deltatar/deltatar.py +++ b/deltatar/deltatar.py @@ -733,14 +733,14 @@ class DeltaTar(object): # for each file to be in the backup, do: for path in self._recursive_walk_dir('.'): - # calculate stat dict for current file - statd = self._stat_dict(path) - statd['path'] = u'snapshot://' + statd['path'] - statd['volume'] = self.vol_no - - # backup file try: # backup file + # calculate stat dict for current file + statd = self._stat_dict(path) + statd['path'] = u'snapshot://' + statd['path'] + statd['volume'] = self.vol_no + + # backup file tarobj.add(path, arcname = statd['path'], recursive=False) except FileNotFoundError as exn: # file vanished since the call to access(3) above