From d5d63dba6bbdf774857e9b8d896b6744b9cf307c Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 9 Aug 2011 08:54:34 +0200 Subject: [PATCH] [entropy.tools] uncompress_tarball: do not use os.listdir() to prove that tarball has been uncompressed --- libraries/entropy/tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/entropy/tools.py b/libraries/entropy/tools.py index 65de3bcb9..dd436e3cd 100644 --- a/libraries/entropy/tools.py +++ b/libraries/entropy/tools.py @@ -1967,6 +1967,7 @@ def uncompress_tarball(filepath, extract_path = None, catch_empty = False): pass tar = None + extracted_something = False try: try: @@ -1997,6 +1998,7 @@ def uncompress_tarball(filepath, extract_path = None, catch_empty = False): tar.extract(tarinfo, encoded_path) + extracted_something = True deleter_counter -= 1 if deleter_counter == 0: del tar.members[:] @@ -2036,7 +2038,7 @@ def uncompress_tarball(filepath, extract_path = None, catch_empty = False): del tar.members[:] tar.close() - if os.listdir(extract_path): + if extracted_something: return 0 if catch_empty: return 0