patch PR25583: debuginfod bsdtar for deb

Frank Ch. Eigler fche@redhat.com
Fri Mar 27 01:32:20 GMT 2020


Hi -

Like this?
(/usr/bin/dkpg-deb is the usual installation path)


diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 5e19db517472..58ba85cf3664 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-26  Frank Ch. Eigler <fche@redhat.com>
+
+       * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
+       after all if access(3)-able, fallback to bsdtar.
+
 2020-03-25  Frank Ch. Eigler <fche@redhat.com>
 
        * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c03bbf922f59..9e8d55609c56 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -429,8 +429,16 @@ parse_opt (int key, char *arg,
       scan_archives[".rpm"]="cat"; // libarchive groks rpm natively
       break;
     case 'U':
-      scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
-      scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+      if (access("/usr/bin/dpkg-deb", X_OK) == 0)
+        {
+          scan_archives[".deb"]="dpkg-deb --fsys-tarfile";
+          scan_archives[".ddeb"]="dpkg-deb --fsys-tarfile";
+        }
+      else
+        {
+          scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
+          scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+        }
       // .udeb too?
       break;
     case 'Z':



More information about the Elfutils-devel mailing list