[elbe-devel] [PATCH v3 2/2] dump: handle empty archive tag

John Ogness john.ogness at linutronix.de
Thu Dec 21 16:57:06 CET 2017


Do not only check if the archive tag exists. Also check if it is
empty. This fixes bug 135 ("empty <archive></archive> tag crashes
a build").

Signed-off-by: John Ogness <john.ogness at linutronix.de>
---
 This patch is new for v3.

 elbepack/commands/get_archive.py | 4 ++--
 elbepack/dump.py                 | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/get_archive.py b/elbepack/commands/get_archive.py
index ec0da856..d2e8ea70 100644
--- a/elbepack/commands/get_archive.py
+++ b/elbepack/commands/get_archive.py
@@ -55,9 +55,9 @@ def run_command( argv ):
         print("Error reading xml file!")
         sys.exit(20)
 
-    if xml.has("archive"):
+    if xml.has("archive") and not xml.text("archive") is None:
         try:
-            unbase( xml.text("/archive"), args[1] )
+            unbase( xml.text("archive"), args[1] )
         except:
             print("Error writing archive")
             sys.exit(20)
diff --git a/elbepack/dump.py b/elbepack/dump.py
index d56e964e..90166c06 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -198,7 +198,7 @@ def elbe_report( xml, buildenv, cache, reportname, errorname, targetfs ):
 
     outf.h2( "archive extract" )
 
-    if xml.has("archive"):
+    if xml.has("archive") and not xml.text("archive") is None:
         with xml.archive_tmpfile() as fp:
             outf.do( 'tar xvfj "%s" -C "%s"' % (fp.name, targetfs.path) )
         mt_index_post_arch = targetfs.mtime_snap()
@@ -278,7 +278,7 @@ def elbe_report( xml, buildenv, cache, reportname, errorname, targetfs ):
     if xml.has("target/pkgversionlist"):
         f.close ()
 
-    if not xml.has("archive"):
+    if not xml.has("archive") or xml.text("archive") is None:
         return
 
     elog = ASCIIDocLog(errorname)
-- 
2.11.0



More information about the elbe-devel mailing list