From 581e433832b0ec0d64116b774b446016dc2383e7 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 4 Jun 2020 12:30:40 +0200 Subject: [PATCH] strip_and_copy_image: abort on broken symlinks Also guard against other processes removing the files we are about to copy. closes fdroid/fdroidserver#783 --- fdroidserver/update.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 4748a7f6..3b7c5951 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -797,6 +797,13 @@ def _strip_and_copy_image(in_file, outpath): """ logging.debug('copying ' + in_file + ' ' + outpath) + if not os.path.exists(in_file): + if os.path.islink(in_file): + logging.warning(_("Broken symlink: {path}").format(path=in_file)) + else: + logging.warning(_("File disappeared while processing it: {path}").format(path=in_file)) + return + if os.path.isdir(outpath): out_file = os.path.join(outpath, os.path.basename(in_file)) else: